ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help in adding XML maps to a worksheet using a script (https://www.excelbanter.com/excel-programming/338196-help-adding-xml-maps-worksheet-using-script.html)

roblo[_4_]

Help in adding XML maps to a worksheet using a script
 

I have been trying to use a script to build, map and populate
worksheet in Excel 2003 with a .XML doc and a .XSD map.

I have not been able to mimic in a script what excel does when mappin
elements to the worksheet using drag & drop. The record marco comman
does not record anything on this d & d function. When using d & d t
map elements, it groups these columns together (blue border aroun
perimeter of all the mapped elements/columns), but using the belo
script it creates separate column lists for each column (separate blu
border around each column). This in turn makes it impossible t
export it back to .XML document, getting error when using the "View ma
for export" command.

Here is the script I use for mapping the elements to each column. Bu
like I said it maps them as separate Column Lists, a new 2003 feature.


'Map elements into spread sheet
strXPath = "/PowerShift/C1A/Customer_number"
Set xp = worksheet.Range("A1:A2").Offset(1,actColumn).XPath
xp.SetValue workbook.XmlMaps(1), strXPath
actColumn = actColumn + 1
'Map elements into spread sheet
strXPath = "/PowerShift/C1A/Customer_type"
Set xp = worksheet.Range("A1:A2").Offset(1,actColumn).XPath
xp.SetValue workbook.XmlMaps(1), strXPath
actColumn = actColumn + 1

How do I map the elements so they don't appear as separate colum
lists?

Thanks,
Rober

--
robl
-----------------------------------------------------------------------
roblo's Profile: http://www.excelforum.com/member.php...fo&userid=2246
View this thread: http://www.excelforum.com/showthread.php?threadid=39866



All times are GMT +1. The time now is 11:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com