Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA IDE and Designer components (Word)

    How can I get access to the properties and events of a Designer in the VBA IDE?

    I want to be able to retrieve/set the properties and retrieve a list of the events being used.
    Where's the "documentation"?

    I'm using something like the following:
    <pre>Option Explicit

    Private Sub CheckProject()
    Dim ctrlUserForm As MSForms.Control
    Dim proc As VBComponent
    Dim proj As VBProject

    On Error Resume Next
    Set proj =
    VBE.VBProjects.Open(Options.DefaultFilePath(wdUser TemplatesPath) _
    & Application.PathSeparator & "SomeFileName.vba")
    If Err.Number <> 0 Then
    'ASSuME already open
    Set proj = VBE.VBProjects("SomeFileName")
    End If
    On Error GoTo 0

    Debug.Print proj.Name, proj.Type

    For Each proc In proj.VBComponents
    With proc
    Debug.Print .Name & vbTab & .Type & vbTab &
    .CodeModule.CountOfLines;
    Select Case .Type
    Case vbext_ct_StdModule
    Debug.Print
    Case vbext_ct_ClassModule
    Debug.Print
    Case vbext_ct_Document
    Debug.Print
    Case vbext_ct_MSForm
    Debug.Print ", Designer " & .DesignerID; " is " &
    IIf(.HasOpenDesigner, "", "not") & "open"
    With proc.Designer
    For Each ctrlUserForm In .Controls
    Debug.Print vbTab & ctrlUserForm.Name
    Next
    End With
    Case vbext_ct_ActiveXDesigner
    Debug.Print ", Designer " & .DesignerID; " is " &
    IIf(.HasOpenDesigner, "", "not") & "open"
    With .Designer
    End With
    Case Else
    End Select
    End With
    Next proc
    Set ctrlUserForm = Nothing
    Set proc = Nothing
    Set proj = Nothing
    End Sub
    </pre>


  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA IDE and Designer components (Word)

    Howard,

    This may be late, but....

    Can you give an example of something that would trigger this chunk of code:

    <hr><pre>Case vbext_ct_ActiveXDesigner
    Debug.Print ", Designer " & .DesignerID; " is " & _
    IIf(.HasOpenDesigner, "", "not") & "open"
    With .Designer
    End With
    </pre>

    <hr>
    This sounds like an interesting challenge and I love intersting challenges. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •