![]() |
|
#1
|
|||
|
|||
![]()
I don't know the term for it (maybe self referencing) but I don't think you need to actually set a reference to the Applications Extensibility Library:
Code:
Sub ExportAllVBAModules() 'Late binding Dim vbProj As Object Dim vbComp As Object Dim strFileName As String, strFilePath As String Dim bExport As Boolean strFilePath = strFilePath = Environ("USERPROFILE") & "\Documents\" 'Path to export to. Set vbProj = ThisDocument.VBProject For Each vbComp In vbProj.VBComponents bExport = False Select Case vbComp.Type Case 1: strFileName = ReplaceInvalidChars(vbComp.Name) & ".bas": bExport = True Case 2: strFileName = ReplaceInvalidChars(vbComp.Name) & ".cls": bExport = True Case 3: strFileName = ReplaceInvalidChars(vbComp.Name) & ".frm": bExport = True End Select If bExport Then strFileName = strFilePath & strFileName vbComp.Export strFileName ' Export the component. Debug.Print "Exported: " & vbComp.Name & " to " & strFileName End If Next vbComp MsgBox "All VBA modules exported to: " & strFilePath, vbInformation, "Export Complete" lbl_Exit: Exit Sub End Sub |
#2
|
|||
|
|||
![]()
The term is: Late Binding
|
![]() |
Tags |
backup/macros, vba save |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word macro to cut a range of text and apply to subsequent text as a hyperlink | scientist101 | Word VBA | 9 | 07-20-2020 04:57 PM |
Macro to add title in header is missing text once macro is run | shawnee24 | Excel Programming | 1 | 05-27-2015 11:50 PM |
Macro to add title in header is missing text once macro is run | shawnee24 | Word VBA | 3 | 05-27-2015 12:35 PM |
Microsoft Word macro to find text, select all text between brackets, and delete | helal1990 | Word VBA | 4 | 02-05-2015 03:52 PM |
Macro to find coloured text and replace with form-field/formtext containing that text | tarktran | Word VBA | 1 | 11-26-2014 08:12 AM |