VBProject

G

Gary

Where can I find a reference on the object VBProject. I need to know all of
the Properties and Methods for this object.

Gary
 
C

Chris Roth [ Visio MVP ]

You have to add a reference: "Microsoft Visual Basic for Applications
Extensibility 5.3" or something similar. Then you can analyze the VBA
project.

Here's some code I wrote to export the modules, classes, and forms in a
project, so that I could import them into VB:

Sub ExportComponents()

Dim v As VBIDE.VBProject
Dim c As VBIDE.VBComponent

Set v = ThisDocument.VBProject

For Each c In v.VBComponents
' Classes:
If Left(c.name, 4) = "CVis" Then
Call exportComponent(c)
End If

' Modules:
If c.name = "ShapeSheet" Then Call exportComponent(c)
If c.name = "LocaleInfo" Then Call exportComponent(c)
Next

End Sub

Private Sub exportComponent(vbcomp As VBIDE.VBComponent)

Dim sName As String, sExt As String

' Set the extension based on component type. Exit sub
' if type not supported.
Select Case vbcomp.Type
Case vbext_ct_ClassModule
sExt = ".cls"
Case vbext_ct_StdModule
sExt = ".bas"
Case Else
Exit Sub
End Select

' Build the name:
sName = ThisDocument.Path & vbcomp.name & sExt

' Save the file:
Call vbcomp.Export(sName)

End Sub

--

Hope this helps,

Chris Roth
Visio MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top