2017-01-27 2 views
1

프로그래밍 방식으로 VBA를 사용하여 Access 파일에서 사용할 수있는 VBA 함수 목록 (텍스트, 테이블, 중요하지 않음)을 생성하고 싶습니다. 나는 사용자 작성 함수 목록을 생성하려고하지 않는다. . . 내장 함수 목록을 생성하려고합니다. 나는 당신이 보면VBA를 사용하여 내장 함수를 나열하고 싶습니다.

을 등 등

왼쪽, INSTR, 날짜, 중간, 오름차순, 역, 월, CSTR 등 : 나는 이런 일을 목록을 생성하고자하는 것 VBA Object Browser에는 Conversion, DateTime, FileSystem, Financial, Information, Interaction, Math 및 String의 클래스 이름 아래에 VBA 명령의 전체 모음이 있습니다.

나는 이러한 클래스를 열거하려고하는 VBA에서 모든 종류의 개체 선언을 시도했지만 성공하지 못했습니다. 내가 할 수 있기를 원하는 것은 함수 이름을 열거하는 것입니다.

+1

프로그래밍 방식으로 개체 브라우저에서 가져 오는 대신 설명서에서 쉽게 찾을 수 없습니까? 사용자가 정의하지 않은 경우 문서화됩니다. –

+1

당신이 요구하는 것은 기본적으로 TypeLib 독자입니다. 구현하기가 어렵지는 않지만, (Rubberduck 애드 인의 독자) (https : //github.com/rubberduck-vba/Rubberduck/tree/next/Rubberduck.Parsing/ComReflection)). XML 파일에서 좋은 것을 읽는다면 [테스트 라이브러리에 버전을 직렬화했습니다] (https : // github.com/rubberduck-vba/Rubberduck/트리/다음/RubberduckTests/테스트 파일/리졸버). – Comintern

+0

https://www.codeproject.com/Articles/5180/RunTime-COM-Object-Inspection –

답변

2

this page 왼쪽의 목록에서 목록을 검색 할 수 있습니다.

+0

이렇게하면 유용합니다 (+1)하지만 OP는 또한 'DMIN()'같은 것을 찾고 있습니다. VBA 그 자체가 아닌 Access-specific입니다. –

4

Rubberduck의 현재 버전 (2.0.12, 아직 출시되지 않았으며 2 월 초로 예정되어 있음)에서 COM API가 다시 작동합니다 (2.0.11 고장). 따라서 현재 버전 ("다음"분기) 비주얼 스튜디오를 사용하여 ... 또는 2.0.12을 기다리는, 당신은 Rubberduck의 형식 라이브러리를 참조하고이 같은 VBA 코드를 작성할 수 있습니다

Option Explicit 

Public Sub ListAllLoadedDeclarations() 
    Dim ducky As Rubberduck.ParserState 
    Set ducky = New Rubberduck.ParserState 
    ducky.Initialize Application.VBE 
    ducky.Parse 

    Dim item As Variant 
    Dim typedItem As Rubberduck.Declaration 

    For Each item In ducky.AllDeclarations 
     Set typedItem = item 
     If typedItem.DeclarationType = DeclarationType_Function _ 
      Or typedItem.DeclarationType = DeclarationType_Procedure _ 
      Or typedItem.DeclarationType = DeclarationType_PropertyGet _ 
      Or typedItem.DeclarationType = DeclarationType_PropertyLet _ 
      Or typedItem.DeclarationType = DeclarationType_PropertySet _ 
     Then 
      ' Project.Module.Member 
      Debug.Print typedItem.ParentDeclaration.ParentDeclaration.Name & "." & _ 
         typedItem.ParentDeclaration.Name & "." & _ 
         typedItem.Name & " (" & DeclarationTypeName(typedItem.DeclarationType) & ")" 
     End If 
    Next 

End Sub 

Private Function DeclarationTypeName(ByVal value As Rubberduck.DeclarationType) As String 
    Select Case value 
     Case DeclarationType_Function 
      DeclarationTypeName = "Function" 
     Case DeclarationType_Procedure 
      DeclarationTypeName = "Sub" 
     Case DeclarationType_PropertyGet 
      DeclarationTypeName = "Property Get" 
     Case DeclarationType_PropertyLet 
      DeclarationTypeName = "Property Let" 
     Case DeclarationType_PropertySet 
      DeclarationTypeName = "Property Set" 
    End Select 
End Function 

이것은 모든 Sub, FunctionProperty 구성원을 나열합니다 모든 초기 바인딩 참조 (VBE의 모든 "사용자 코드"포함) 즉치 창에 인쇄하십시오 (을 변경하려는 경우여기) 엑셀 프로젝트에 (이런 걸보고) 아마, 파일에 쓸 수 :

이 숨겨진 멤버를 포함하고 Rubberduck뿐만 아니라 반환 형식, 매개 변수 및 가시성 알고있는
(snip) 
Excel.PivotTable.Name (Property Let) 
Excel.PivotTable.ViewCalculatedMembers (Property Get) 
Excel.PivotTable.SourceData (Property Get) 
Excel.PivotTable.InGridDropZones (Property Get) 
Excel.PivotTable.GrandTotalName (Property Get) 
Excel.PivotTable.Update (Sub) 
Excel.PivotTable.SmallGrid (Property Get) 
Excel.PivotTable.EnableWriteback (Property Get) 
Excel.PivotTable.Version (Property Get) 
Excel.PivotTable.ShowCellBackgroundFromOLAP (Property Get) 
Excel.PivotTable.RowRange (Property Get) 
Excel.PivotTable.CalculatedFields (Function) 
Excel.PivotTable.AllocateChanges (Sub) 
Excel.PivotTable.AllocationValue (Property Get) 
Excel.PivotTable.DisplayMemberPropertyTooltips (Property Let) 
Excel.PivotTable.CacheIndex (Property Let) 
Excel.PivotTable.CompactRowIndent (Property Get) 
Excel.PivotTable.DiscardChanges (Sub) 
Excel.PivotTable.EnableDrilldown (Property Get) 
Excel.PivotTable.AlternativeText (Property Get) 
Excel.PivotTable.DataLabelRange (Property Get) 
Excel.PivotTable.ListFormulas (Sub) 
Excel.PivotTable.AllowMultipleFilters (Property Let) 
Excel.PivotTable.RowAxisLayout (Sub) 
Excel.PivotTable.ShowTableStyleColumnHeaders (Property Get) 
Excel.PivotTable.Tag (Property Get) 
Excel.PivotTable.LayoutRowDefault (Property Get) 
Excel.PivotTable.DataPivotField (Property Get) 
Excel.PivotTable.TableStyle (Property Get) 
Excel.PivotTable.DisplayNullString (Property Get) 
Excel.PivotTable.PageRange (Property Get) 
Excel.PivotTable.CalculatedMembersInFilters (Property Get) 
Excel.PivotTable.ShowPageMultipleItemLabel (Property Get) 
Excel.PivotTable.Summary (Property Let) 
Excel.PivotTable.DisplayFieldCaptions (Property Let) 
Excel.PivotTable.ChangePivotCache (Sub) 
Excel.PivotTable.ShowTableStyleRowStripes (Property Let) 
Excel.PivotTable.EnableWizard (Property Let) 
Excel.PivotTable.PageFields (Property Get) 
Excel.PivotTable.PageFieldOrder (Property Get) 
Excel.PivotTable.PrintTitles (Property Let) 
Excel.PivotTable.SubtotalHiddenPageItems (Property Get) 
Excel.PivotTable.VisualTotalsForSets (Property Let) 
Excel.PivotTable.ShowTableStyleRowHeaders (Property Let) 
Excel.PivotTable.PivotSelectionStandard (Property Get) 
Excel.PivotTable.AddFields (Function) 
Excel.PivotTable.CompactLayoutRowHeader (Property Get) 
Excel.PivotTable.RepeatItemsOnEachPrintedPage (Property Get) 
Excel.PivotTable.AllocationMethod (Property Let) 
Excel.PivotTable.VacatedStyle (Property Get) 
Excel.PivotTable.Value (Property Get) 
Excel.PivotTable.GetPivotData (Function) 
Excel.PivotTable.InnerDetail (Property Let) 
Excel.PivotTable.Format (Sub) 
Excel.PivotTable.PageFieldStyle (Property Get) 
Excel.PivotTable.SubtotalLocation (Sub) 
Excel.PivotTable.ShowPages (Function) 
Excel.PivotTable.ShowValuesRow (Property Let) 
Excel.PivotTable.MDX (Property Get) 
Excel.PivotTable.DataBodyRange (Property Get) 
Excel.PivotTable.PreserveFormatting (Property Get) 
Excel.PivotTable.DisplayContextTooltips (Property Let) 
Excel.PivotTable.ChangeList (Property Get) 
Excel.PivotTable.Location (Property Let) 
Excel.PivotTable.PivotSelection (Property Let) 
Excel.PivotTable.RefreshDate (Property Get) 
Excel.PivotTable.VisibleFields (Property Get) 
Excel.PivotTable.MergeLabels (Property Get) 
Excel.PivotTable.EnableDataValueEditing (Property Let) 
Excel.PivotTable.TableRange1 (Property Get) 
Excel.PivotTable.ShowDrillIndicators (Property Get) 
Excel.PivotTable.Allocation (Property Get) 
Excel.PivotTable.Parent (Property Get) 
Excel.PivotTable.DisplayImmediateItems (Property Let) 
Excel.PivotTable.HasAutoFormat (Property Get) 
Excel.PivotTable.PageFieldWrapCount (Property Get) 
Excel.PivotTable.EnableFieldDialog (Property Let) 
Excel.PivotTable.RepeatAllLabels (Sub) 
Excel.PivotTable.VisualTotals (Property Get) 
Excel.PivotTable.DisplayEmptyColumn (Property Get) 
Excel.PivotTable.CubeFields (Property Get) 
Excel.PivotTable.ShowTableStyleLastColumn (Property Get) 
Excel.PivotTable.PivotTableWizard (Sub) 
Excel.PivotTable.PageRangeCells (Property Get) 
Excel.PivotTable.DisplayErrorString (Property Let) 
Excel.PivotTable.RowGrand (Property Let) 
Excel.PivotTable.SortUsingCustomLists (Property Get) 
Excel.PivotTable._Default (Property Let) 
Excel.PivotTable.ColumnGrand (Property Let) 
Excel.PivotTable.CalculatedMembers (Property Get) 
Excel.PivotTable.Application (Property Get) 
Excel.PivotTable.ShowTableStyleColumnStripes (Property Get) 
Excel.PivotTable.PivotColumnAxis (Property Get) 
Excel.PivotTable.NullString (Property Get) 
Excel.PivotTable.Slicers (Property Get) 
Excel.PivotTable.ErrorString (Property Let) 
Excel.PivotTable.AllocationWeightExpression (Property Get) 
Excel.PivotTable.DisplayEmptyRow (Property Get) 
Excel.PivotTable.SaveData (Property Get) 
Excel.PivotTable.EnableFieldList (Property Get) 
Excel.PivotTable.SelectionMode (Property Let) 
Excel.PivotTable.FieldListSortAscending (Property Get) 
Excel.PivotTable.RefreshDataSourceValues (Sub) 
Excel.PivotTable.ViewCalculatedMembers (Property Let) 
Excel.PivotTable.SourceData (Property Let) 
Excel.PivotTable.TableStyle2 (Property Get) 
Excel.PivotTable.CommitChanges (Sub) 
Excel.PivotTable.InGridDropZones (Property Let) 
Excel.PivotTable.GrandTotalName (Property Let) 
Excel.PivotTable.TotalsAnnotation (Property Get) 
Excel.PivotTable.CompactLayoutColumnHeader (Property Get) 
Excel.PivotTable.PrintDrillIndicators (Property Get) 
Excel.PivotTable.SmallGrid (Property Let) 
Excel.PivotTable.EnableWriteback (Property Let) 
Excel.PivotTable.ManualUpdate (Property Get) 
Excel.PivotTable.Name (Property Get) 
Excel.PivotTable.ShowCellBackgroundFromOLAP (Property Let) 
Excel.IFont.TintAndShade (Property Let) 
Excel.IFont.Creator (Property Get) 
Excel.IFont.ThemeColor (Property Get) 
Excel.IFont.Size (Property Get) 
Excel.IFont.Italic (Property Get) 
Excel.IFont.Strikethrough (Property Get) 
Excel.IFont.FontStyle (Property Get) 
Excel.IFont.Parent (Property Get) 
Excel.IFont.Color (Property Get) 
Excel.IFont.Name (Property Get) 
Excel.IFont.OutlineFont (Property Get) 
Excel.IFont.Application (Property Get) 
Excel.IFont.Underline (Property Get) 
Excel.IFont.ThemeColor (Property Let) 
Excel.IFont.Size (Property Let) 
Excel.IFont.Italic (Property Let) 
Excel.IFont.Strikethrough (Property Let) 
Excel.IFont.FontStyle (Property Let) 
Excel.IFont.ThemeFont (Property Get) 
Excel.IFont.Color (Property Let) 
Excel.IFont.Name (Property Let) 
Excel.IFont.OutlineFont (Property Let) 
Excel.IFont.Underline (Property Let) 
Excel.IFont.Shadow (Property Get) 
Excel.IFont.ThemeFont (Property Let) 
Excel.IFont.Superscript (Property Get) 
Excel.IFont.Subscript (Property Get) 
Excel.IFont.ColorIndex (Property Get) 
Excel.IFont.Shadow (Property Let) 
Excel.IFont.Superscript (Property Let) 
Excel.IFont.Subscript (Property Let) 
Excel.IFont.Bold (Property Get) 
Excel.IFont.ColorIndex (Property Let) 
Excel.IFont.Background (Property Get) 
Excel.IFont.Bold (Property Let) 
Excel.IFont.TintAndShade (Property Get) 
Excel.IFont.Background (Property Let) 
Rubberduck._Extension.OnBeginShutdown (Sub) 
Rubberduck._Extension.OnConnection (Sub) 
Rubberduck._Extension.OnStartupComplete (Sub) 
Rubberduck._Extension.ToString (Property Get) 
Rubberduck._Extension.OnAddInsUpdate (Sub) 
Rubberduck._Extension.GetHashCode (Function) 
Rubberduck._Extension.OnDisconnection (Sub) 
Rubberduck._Extension.GetType (Function) 
Rubberduck._Extension.Equals (Function) 
Excel.IPivotLines.Application (Property Get) 
Excel.IPivotLines.Parent (Property Get) 
Excel.IPivotLines.Creator (Property Get) 
Excel.IPivotLines.Item (Property Get) 
Excel.IPivotLines.Count (Property Get) 
Excel.IPivotLines._NewEnum (Property Get) 
Excel.IPivotLines._Default (Property Get) 
Office.ICTPFactory.CreateCTP (Function) 
Office.IRibbonControl.Tag (Property Get) 
Office.IRibbonControl.Context (Property Get) 
Office.IRibbonControl.Id (Property Get) 
Office.FoundFiles.Application (Property Get) 
Office.FoundFiles.Count (Property Get) 
Office.FoundFiles.Creator (Property Get) 
Office.FoundFiles._NewEnum (Property Get) 
Office.FoundFiles.Item (Property Get) 
Office.PickerDialog.Creator (Property Get) 
Office.PickerDialog.CreatePickerResults (Function) 
Office.PickerDialog.Resolve (Function) 
Office.PickerDialog.Title (Property Let) 
Office.PickerDialog.Show (Function) 
Office.PickerDialog.Title (Property Get) 
Office.PickerDialog.DataHandlerId (Property Let) 
Office.PickerDialog.Properties (Property Get) 
Office.PickerDialog.Application (Property Get) 
Office.PickerDialog.DataHandlerId (Property Get) 
Excel.Menu.Enabled (Property Let) 
Excel.Menu.MenuItems (Property Get) 
Excel.Menu.Enabled (Property Get) 
Excel.Menu.Delete (Sub) 
Excel.Menu.Parent (Property Get) 
Excel.Menu.Caption (Property Let) 
Excel.Menu.Index (Property Get) 
Excel.Menu.Caption (Property Get) 
Excel.Menu.Creator (Property Get) 
Excel.Menu.Application (Property Get) 

주, 하지만 API는 현재 쿼리를 효율적으로 수행하기가 어렵습니다.

Rubberduck의 COM API는 여전히 큰 변화를 겪었으며 제안 및 기능 요청에 매우 개방되어 있으므로 어떤 프로덕션 코드에서도 사용하지 않는 것이 좋습니다.하지만 놀아 볼 수는 있습니다. MSDN을 긁거나 자신의 COM 형식 라이브러리 판독기/반사기를 작성하는 것보다 훨씬 쉽습니다. 우리의 테스트 및 웹 사이트의이 기능은 VBE 외부에서 작업 할 수 있습니다 "코드 검사 시도"그래서 우리는 XML이 정보를 직렬화하기 때문에


, 당신은 또한 너무, 우리의 XML files를 역 직렬화하고, 모든 정보를 얻기 위해 시도 할 수 있습니다.


전체 공개 : 나는 Rubberduck의 발전에 크게 관여입니다.

+0

사실, XML 파일에는 COM API가 노출되는 것보다 훨씬 많은 정보가 포함되어 있습니다 (기본적으로 Rubberduck의 내부 '선언'표현이지 API에 표시되는 단순화 된 버전이 아닙니다). 따라서 필요에 따라 그. –

관련 문제