Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2025, 11:50 AM
gmaxey gmaxey is offline macro to backup my VBA/macro text Windows 10 macro to backup my VBA/macro text Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #2  
Old 02-10-2025, 12:14 PM
Italophile Italophile is offline macro to backup my VBA/macro text Windows 11 macro to backup my VBA/macro text Office 2021
Expert
 
Join Date: Mar 2022
Posts: 555
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by gmaxey View Post
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
The term is: Late Binding
Reply With Quote
Reply

Tags
backup/macros, vba save



Similar Threads
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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:58 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft