0

Question:

  • How can one control Excel's XML export process?
  • Are options, excluding save to file, available?

Big Picture, moving data from Excel XML table to ERP application.

Current solution:

Setup:

  • Developer Tab is activated in end user's Excel
  • Spreadsheet with XSD map pre-loaded and pre-mapped is provide to end user

User modifies data in Excel and performs data transfer by:

  • [Developer Tab], [Export], [Export XML] (similar to Save-As dialog), specify file name, click [Export] button, data is exported to XML file
  • User opens saved XML file via notepad (or any editor that does not "render" the xml), "select all", copy to clip board
  • User opens a "paste dialog" box run by ERP application, pastes XML from clipboard, and submits to ERP for processing.

Better Solutions would include:

  1. Save XML directly to clipboard
  2. One Click Post XML directly to Webservice run by ERP
  3. Any solution where non-technical users do not have to manipulate/handle files in the transfer process

For the sake of exploring options, lets assume the security requirements will be appropriately handled.

Thoughts or ideas? TIA

Tim C
  • 13
  • 3

1 Answers1

0

For #1:

Sub Tester()


    Dim map As XmlMap, strXML As String

    Set map = ActiveWorkbook.XmlMaps("data-set_Map")
    map.ExportXml strXML  'puts the map XML into strXML

    Debug.Print strXML

    'requires project reference to Microsoft Form 2.0 Object Library
    Dim dob As New DataObject
    dob.SetText strXML
    dob.PutInClipboard 'set xml in clipboard

End Sub

. #2 would be doable but more work

Tim Williams
  • 154,628
  • 8
  • 97
  • 125