Export to XML

Chrisopia

Registered User.
Local time
Today, 04:44
Joined
Jul 18, 2008
Messages
279
Is there not a manual way to create an "export to XML" tool?

at the moment I'm using the wizard, which is all very well but it's extremely limited.

Things like customising the path to export the XML can't be done!?

I am designing a system for a computer network with no access on it and it exports an XML for a separate tool. The tool is on the network too, and I have the path for where the XML should go.

Unfortunately the export wizard will only let me export the XML to an already existing location, hence it can only set up if its on the network. It wont let me just type the path in (because it doesn't yet exist)
And also for testing sake, I should be allowed to alter the path name to a local file.

Also naming the file, I want 2 copies to be made, one replaces an old one (i.e. has the same name as the old one), and one creates a new file with the name + date stamp.

Both of these are extremely useful things to customise, but the wizard won't let me! Perhaps a more manual way to export the XML in VBA would be best.

Hope you can help!
 
I found the answer. The command "Application.ExportXML" has everything I need to do and customise my export.

There are extra properties such as the path for the schema too. But running the code twice, but with the second one adding a date format to the end seems to do the trick.
If course, I haven't tested it on the network yet but looks promising.

Code:
Private Sub Command1_Click()
Dim Path As String
Dim datum As String

datum = Format(Date, "dd_mmmm_yyyy")
Path = "\\Main-pc\main-files\Invoices\"
                          
    Application.ExportXML acExportQuery, "Yelloows", Path & "Yelloows.xml"
    Application.ExportXML acExportQuery, "Yelloows", Path & "Yelloows_" & datum & ".xml"
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom