Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default xla export classes, modules and forms

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   Report Post  
Posted to microsoft.public.excel.programming
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?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default xla export classes, modules and forms

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export VBA Modules Robin Clay[_4_] Excel Programming 7 November 7th 09 06:25 PM
Public, Private, Event modules, Forms modules,,, Jim May Excel Programming 11 October 31st 05 03:12 AM
Forms and Modules scrabtree23[_2_] Excel Programming 4 November 11th 03 03:57 PM
Modules and Forms II Pedro Excel Programming 1 November 7th 03 11:19 AM
Modules and Forms Pedro Excel Programming 2 November 6th 03 02:02 PM


All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"