Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In a regular excel document I can export all of the code by the following:
Sub ExportAllVBA() Dim VBComp As VBIDE.VBComponent Dim Sfx As String For Each VBComp In ActiveWorkbook.VBProject.VBComponents Select Case VBComp.Type Case vbext_ct_ClassModule, vbext_ct_Document Sfx = ".cls" Case vbext_ct_MSForm Sfx = ".frm" Case vbext_ct_StdModule Sfx = ".bas" Case Else Sfx = "" End Select If Sfx < "" Then VBComp.Export _ Filename:=ActiveWorkbook.Path & "\" & VBComp.Name & Sfx End If Next VBComp End Sub If I go inside of my xla and run this, I can only get the thisworkbook. none of the forms, classes or modules get exported. is there a way to export these in an xla? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not tested...
Go into the ThisWorkbook properties of the addin and change IsAddin to False Run your program Go back and change IsAddin to True -- Hope this helps. Thanks in advance for your feedback. Gary Brown "greg" wrote: In a regular excel document I can export all of the code by the following: Sub ExportAllVBA() Dim VBComp As VBIDE.VBComponent Dim Sfx As String For Each VBComp In ActiveWorkbook.VBProject.VBComponents Select Case VBComp.Type Case vbext_ct_ClassModule, vbext_ct_Document Sfx = ".cls" Case vbext_ct_MSForm Sfx = ".frm" Case vbext_ct_StdModule Sfx = ".bas" Case Else Sfx = "" End Select If Sfx < "" Then VBComp.Export _ Filename:=ActiveWorkbook.Path & "\" & VBComp.Name & Sfx End If Next VBComp End Sub If I go inside of my xla and run this, I can only get the thisworkbook. none of the forms, classes or modules get exported. is there a way to export these in an xla? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Change this:
For Each VBComp In ActiveWorkbook.VBProject.VBComponents to this: For Each VBComp In ThisWorkbook.VBProject.VBComponents RBS "greg" wrote in message ... In a regular excel document I can export all of the code by the following: Sub ExportAllVBA() Dim VBComp As VBIDE.VBComponent Dim Sfx As String For Each VBComp In ActiveWorkbook.VBProject.VBComponents Select Case VBComp.Type Case vbext_ct_ClassModule, vbext_ct_Document Sfx = ".cls" Case vbext_ct_MSForm Sfx = ".frm" Case vbext_ct_StdModule Sfx = ".bas" Case Else Sfx = "" End Select If Sfx < "" Then VBComp.Export _ Filename:=ActiveWorkbook.Path & "\" & VBComp.Name & Sfx End If Next VBComp End Sub If I go inside of my xla and run this, I can only get the thisworkbook. none of the forms, classes or modules get exported. is there a way to export these in an xla? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Export VBA Modules | Excel Programming | |||
Public, Private, Event modules, Forms modules,,, | Excel Programming | |||
Forms and Modules | Excel Programming | |||
Modules and Forms II | Excel Programming | |||
Modules and Forms | Excel Programming |