RickSprague
08-17-2010, 05:05 AM
I am using Microsoft Visual Basic for Applications Extensibility library to copy modules from one workbook to another. I have the following code copied from another website:
Global VBAEditor As VBIDE.VBE
Global VBProj As VBIDE.VBProject
Global VBComp As VBIDE.VBComponent
Global CodeMod As VBIDE.CodeModule
Global xlApp As Object
Global wb As Object
Global ws As Object
Global FSO As Scripting.FileSystemObject
Global SourceFolder As Scripting.Folder
Function CopyModule(ModuleName As String, _
FromVBProject As VBIDE.VBProject, _
ToVBProject As VBIDE.VBProject, _
OverwriteExisting As Boolean) As Boolean
...code
End Function
My question is, how do I call this function in the Immediate Window? I tried:
? CopyModule("mdlTest","Book1","Book2",True) but, of course that doesn't work because Book1 & Book2 should be VBProjects. I'm stuck!!
Global VBAEditor As VBIDE.VBE
Global VBProj As VBIDE.VBProject
Global VBComp As VBIDE.VBComponent
Global CodeMod As VBIDE.CodeModule
Global xlApp As Object
Global wb As Object
Global ws As Object
Global FSO As Scripting.FileSystemObject
Global SourceFolder As Scripting.Folder
Function CopyModule(ModuleName As String, _
FromVBProject As VBIDE.VBProject, _
ToVBProject As VBIDE.VBProject, _
OverwriteExisting As Boolean) As Boolean
...code
End Function
My question is, how do I call this function in the Immediate Window? I tried:
? CopyModule("mdlTest","Book1","Book2",True) but, of course that doesn't work because Book1 & Book2 should be VBProjects. I'm stuck!!