View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Brown[_4_] Gary Brown[_4_] is offline
external usenet poster
 
Posts: 209
Default xla export classes, modules and forms

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?