Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using XMLMaps from VB(A)-Code

I've managed to write VB-code that creates an XMLMap using code like this
(...
Set LoXMLMap = LoWorkbook.XmlMaps.Add(XSDFileName, MAP_ROOTNODE
LoXMLMap.Name = MAP_NAM

After that, I map the columns using a loop where each iteration does the following

LoWorkbook.ActiveSheet.Range(LsPrefix & LsCol & "1").XPath.setValue
LoWorkbook.XmlMaps(MAP_NAME),
"/" & MAP_ROOTNODE & "/doc/Element/@" & GsAttributes(LiCount), , Tru

Finally I import my data to the map
LoWorkbook.XmlMaps(MAP_NAME).Import PsTransformedXMLDoc, Tru

All works well except one detail: For those rows that don't have an attribute X, I would expect Excel to leave the cell in the corresponding cell empty. However, as soon as a row shows up that has the attribute X, the attribute's value is not entered on the row where it belongs, but in the first unused cell of the column

Say my data in the xml file is as follows
<Person Name="Paul" Job="Cassier"<Person Name="John" Phone="123456"<Person Name="Peter" Job="Butcher" Phone="234567"
Note that Paul has no Phone attribute and John has no Job attribute

What I expect

Name Job Phon
Paul Cassier
John 12345
Peter Butcher 23456

What I get

Name Job Phon
Paul Cassier 12345
John Butcher 23456
Peter

Anyone any ideas on how I can force the right content from VBA?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
XmlMaps "java_Map40" teepee[_3_] Excel Discussion (Misc queries) 0 November 16th 08 10:07 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Automation Adding XmlMaps & SaveAsXMLData in Excel Peter Torr \(MS\) Excel Programming 0 February 29th 04 06:16 AM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM


All times are GMT +1. The time now is 06:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"