Thanks for all your replies!
Steve,
When I try to run your macro, I'm getting a "User defined type not
defined" error on the
Dim VBComp As VBIDE.VBComponent
line. I tracked it down on Chip's page, and found that it needs access
to a file in Winhelp which I can't access. Is there a workaround for
that?
Thanks!
STEVE BELL wrote:
This is from Chip Pearson's site -
http://www.cpearson.com/excel/vbe.htm
Exporting All Modules In A Project
The procedure below will list export all of the modules in a workbook to
text files. It will save the files in the same folder as the workbook. This
can be useful for saving a backup copy of your VBA, or for transferring VBA
code from one project to another.
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
--
steveB
Remove "AYN" from email to respond
"Jim Thomlinson" wrote in message
...
You have lost me a bit here. When you save a spreadsheet all of the macros
are saved with it. If you have any modules, classes or forms that are
particularily useful and you would want to use them in other projects you
can
export them, to be imported into the other porjects. With addin's you just
have to remember to save them when you make changes and before you exit
excel
(or remove the addin). If this does not cover it let us know... Or maybe I
am
just missing something...
--
HTH...
Jim Thomlinson
"davegb" wrote:
I googled here, but no joy. So, is it possible to create a macro to
save all my macros? I've accumulated quite a set by now, with a lot of
help here, and I've saved the modules. But it's getting tedious to save
them all. Has anyone done this?