Documentation for VBProject

W

Wes Jester

I am trying to find the documentation for VBProject without much success.
The difficulty I am having is in Removing and Importing modules. During
this process, the module is not acutally removed until the maintenance
module is exited. Therefore, all the names of the imported modules have a 1
appened to it.

I want to setup another module to call that will go thru the modules and
rename them back to the original names. So, I am looking for all the
methods and properties available for VBProject

Thanks

Wes
 
D

David Hager

Under Tools, References you need to select the Microsoft Visual Basic for
Applications Extensibility checkbox.

David Hager
Excel MVP
 
B

Bernie Deitrick

Wes,

The remove codemodule command is a little convoluted, since your use the .Remove method on the VBComponents collection, and pass the
module to be removed as an object:

With ActiveWorkbook.VBProject
..VBComponents.Remove .VBComponents("myModule")
End With

OR

ActiveWorkbook.VBProject.VBComponents.Remove _
ActiveWorkbook.VBProject.VBComponents("myModule")

Importing is the same general idea, except you pass a string with the filename and path.

ActiveWorkbook.VBProject.VBComponents.Import "C:\Excel\myModule2.bas"

The codemodule is actually removed immediately: I learned this technique
from Rob Bovey's VBA Code Cleaner, which you can find through Google.
His code is unprotected - which is very nice of Rob - so you can learn from
a master.

HTH,
Bernie
Excel 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