Document.ExportToDatabase
Method: ExportToDatabase (pFromChild as XMLData, pExportSettings as ExportSettings, pDatabase as DatabaseConnection)
Description
ExportToDatabase exports the XML document starting with the element pFromChild. The parameter pExportSettings defines the behaviour of the export (see Application.GetExportSettings). The parameter pDatabase specifies the destination of the export (see Application.GetDatabaseSettings). UpdateXMLData() might be indirectly needed as you have to pass the XMLData as parameter to this function.
Errors
1400 | The object is no longer valid. |
1407 | Invalid parameter or invalid address for the return parameter was specified. |
1416 | Error during export. |
1429 | Database selection missing. |
1430 | Document export failed. |
Example
Dim objDoc As Document
Set objDoc = objSpy.ActiveDocument
'set the behaviour of the export with ExportSettings
Dim objExpSettings As ExportSettings
Set objExpSettings = objSpy.GetExportSettings
'set the destination with DatabaseConnection
Dim objDB As DatabaseConnection
Set objDB = objSpy.GetDatabaseSettings
objDB.CreateMissingTables = True
objDB.CreateNew = True
objDB.File = "C:\Export.mdb"
objDoc.ExportToDatabase objDoc.RootElement, objExpSettings, objDB
If Err.Number <> 0 Then
a = MsgBox("Error: " & (Err.Number - vbObjectError) & Chr(13) &
"Description: " & Err.Description)
End If