- Local time
- Today, 05:37
- Joined
- Jan 23, 2006
- Messages
- 15,456
Marshall,
To output the DM xml, you can add and use this procedure to a module in your BE to SaveAsText to a stated location.
Also, if you open the xml file with Notepad++ and then use the xml plugin - Pretty Print
To output the DM xml, you can add and use this procedure to a module in your BE to SaveAsText to a stated location.
Also, if you open the xml file with Notepad++ and then use the xml plugin - Pretty Print
Code:
' Procedure : SaveAllDataMacros
' Author : mellon
' Date : 16-Jun-2017
' Purpose : Routine to output or load data macros.
'To export:
'SaveAsText acTableDataMacro, "TableName", "C:\PathToFile\DataMacro.xml"
'
'To import:
'LoadFromText acTableDataMacro, "TableName", "C:\PathToFile\DataMacro.xml"
'You can open the output xml files with notepad++ and use the XML plugin with Pretty print with line feed.
'
'**Tested for the SaveAsText 16-Jun-2017
'---------------------------------------------------------------------------------------
'
Sub SaveAllDataMacros()
Dim db As DAO.Database
Dim tbl As DAO.TableDef
Dim sSaveMacro As String
Dim sLoadMacro As String
10 On Error GoTo SaveAllDataMacros_Error
20 Dim cons As String: cons = "acTableDataMacro"
30 Set db = CurrentDb
40 For Each tbl In db.TableDefs
50 If Left(tbl.Name, 4) <> "MSys" And _
Left(tbl.Name, 4) <> "USys" Then
60 Debug.Print "SaveAsText " & cons & " , """ & tbl.Name & """, ""C:\Users\jp\Documents\macrosFor_" & tbl.Name & ".xml"
70 Application.SaveAsText acTableDataMacro, tbl.Name, "C:\Users\jp\Documents\macrosFor_" & tbl.Name & ".xml"
80 End If
90 Next tbl
SaveAllDataMacros_Exit:
100 Exit Sub
SaveAllDataMacros_Error:
110 If Err.Number = 2950 Then
120 Debug.Print vbTab & tbl.Name & " has no associated data macro(s)"
130 Resume Next
140 End If
150 MsgBox "Error " & Err.Number & " in line " & Erl & " (" & Err.Description & ") in procedure SaveAllDataMacros of Module basModule1"
160 Resume SaveAllDataMacros_Exit
End Sub
Last edited: