Replacing Forms, Modules, And Class Modules From Code

G

Gary

I have a large Visio Application that sometimes needs bug fixes or
enhancements. Is there a way, using for example VB, that I could open the
Visio Application, delete a module or form, and then import the new object?

Thanks

Gary
 
J

junethesecond

Export method to VBComponent, and import method to VBProjects might be
useful. The are included in Microsoft Visual Basic for Applications
Extensibility.
If you add "Microsoft Visual Basic for Applications Extensibility" to your
reference,
next example will be excutable.
Dim Proj As VBProject
Dim Comps As VBComponents
Dim Comp As VBComponent
Dim N As Long, I As Long

For Each Proj In Vbe.VBProjects
Debug.Print Proj.Name
Set Comps = Proj.VBComponents
N = Comps.Count
For I = 1 To N
For Each Comp In Proj.VBComponents
Debug.Print Comp.Name, Comp.Type
Next
Next
Next

Set Comp = Comps.Import("FILE")
Comp.Export ("FILE")
 
G

Gary

Ok, I have found that I can use the remove method and the import method of
the VBProject.VBComponent object. Now the next problem. The VBA code has
been password protected to keep user from seeing the code. How can I use the
remove and import methods when the VBA code I'm trying to access has
protection. I can't seem to find any methods or properties that allow me to
pass a password and unlock the code. Any ideas?

Thanks

Gary
 
J

junethesecond

I think tere is no way to access protected projects, but you could know if
protected or not, using protection property.
 

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