Excel 2010 XML Maps

We introduced Excel XML Map objects in Excel 2003. We carried those forward into Excel 2007 and, of course, into Excel 2010. I recently stumbled on an Excel developer blog by Roy Maclean, and I was really glad to see him exploring a scenario and sharing his findings. It'll be great to see his Part 2 of that.

Basically, Roy shows using Excel front-end receiver/exporter for XML-based data. It receives data from XML that is mapped to a schema. It can then pump the data back out in a meaningful context because of the schema mapping.

If you are new to XML Mapping in Excel, then here are a few things to help you:

1) Here's a short video that shows you what it's all about: https://msdn.microsoft.com/en-us/office/bb872411.aspx

2) Here's a great intro set of samples you can try to get started: https://msdn.microsoft.com/en-us/library/aa203737(office.11).aspx

Couple of interesting things I uncovered as I verified that the items in #2 above work in Excel 2010.

FYI: here's what one of the MSDN samples looks like on my machine today:

Excel2010XMLMap[1]

We introduced a new object in Excel 2007--- the WorkbookConnection object. Basically, this lets you create a new connection to data. Here's a quick sample:

 Private Sub WorkbookConnections()
    Dim myConnection As Excel.WorkbookConnection = _
        Me.Connections.AddFromFile("c:\SalesData.csv")
    myConnection.Description = "Data stored in a CSV file."

    For Each connection As Excel.WorkbookConnection In Me.Connections
        MessageBox.Show(connection.Name + " " + connection.Type.ToString() _
            + " " + connection.Description)
    Next
End Sub

We also introduced a new property--- the Creator property that lets you know which application was used to create a given XMLMap. According to our documentation: This returns a 32-bit integer that indicates the application in which the specified object was created. If the object was created in Microsoft Graph, this property returns the string MSGR, which is equivalent to the hexadecimal number 4D534752. Read-only

Technorati Tags: Office 2010,Developer,Excel,XML,VBA,Office,Macro,Microsoft,Productivity

Rock Thought of the Day: Mouthful of Diamonds by Phantogram

I heard this song on www.kexp.org, and it caught my imagination. Watch them perform it live: