Export VBA Macros to bas, text, into document, whatever
Hi, I'm trying to export all macros that are in Word.
I've tried tweaking what worked in Excel, to no avail.
Then, I found the below code (author not listed). BUT, I'd like text to be saved instead of being shown in Msg boxes. The below code shows a Msg box for each macro.
Can someone please help? I'd like to either have each macro pasted into one word document, or have each saved as a .bas file. Using a Mac as far as paths...
Thanks!!
-Ashley
Sub GetCode()
Dim prj As VBProject
Dim comp As VBComponent
Dim code As CodeModule
Dim composedFile As String
Dim i As Integer
Set prj = ThisDocument.VBProject
For Each comp In prj.VBComponents
Set code = comp.CodeModule
composedFile = comp.Name & vbNewLine
For i = 1 To code.CountOfLines
composedFile = composedFile & code.Lines(i, 1) & vbNewLine
Next
[-this is where I'd like a file save or paste code. Obviously, nothing with selection.copy worked ;-)]
MsgBox composedFile
Next
End Sub