M
Matt Williamson
I'm looping through all access mdb's in a directory and changing all of
the SQL links to be DSNless. At the same time I'd like to update the
TransferText path in a bunch of Macros but I can't figure out how to
reference the application object of the database I just opened. This
code works fine for the current database if I add it a module and run
it. How do I reference the application object of another database
without creating a new app instance?
Sub FixPathInMacros()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllMacros collection.
For Each obj In dbs.AllMacros
If obj.IsLoaded = True Then
' Print name of obj.
Debug.Print cp.Name & "_" & obj.Name
'SaveAsText acMacro, obj.Name, "C:\Temp\" _
& obj.Name & ".txt"
'FixPath "C:\Temp\" & obj.Name & ".txt", _
"\\\Server\\Folder\\"
'LoadFromText acMacro, obj.Name, "C:\Temp\" & _
obj.Name & ".txt"
End If
Next obj
End Sub
TIA
Matt
the SQL links to be DSNless. At the same time I'd like to update the
TransferText path in a bunch of Macros but I can't figure out how to
reference the application object of the database I just opened. This
code works fine for the current database if I add it a module and run
it. How do I reference the application object of another database
without creating a new app instance?
Sub FixPathInMacros()
Dim obj As AccessObject, dbs As Object
Set dbs = Application.CurrentProject
' Search for open AccessObject objects in AllMacros collection.
For Each obj In dbs.AllMacros
If obj.IsLoaded = True Then
' Print name of obj.
Debug.Print cp.Name & "_" & obj.Name
'SaveAsText acMacro, obj.Name, "C:\Temp\" _
& obj.Name & ".txt"
'FixPath "C:\Temp\" & obj.Name & ".txt", _
"\\\Server\\Folder\\"
'LoadFromText acMacro, obj.Name, "C:\Temp\" & _
obj.Name & ".txt"
End If
Next obj
End Sub
TIA
Matt