By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,116 Members | 1,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,116 IT Pros & Developers. It's quick & easy.

Vbs Importing XML into Excel problem

P: 2
I have an excel/vba project I've been working on and run into some trouble importing a xml file to my workbook. The existing xmlmap is valid and the xml file imports when using the import xml under the Data dropdown menu however it fails to import using the vbs script I've written. I use the default schema as the xmlmap is very simple and have come across a page from microsoft here that mentions that I have to unwrap certain objects when the ExcelLocale1033Attribute is set to true. The syntax however, eludes me. Here's what I'd like to insert the proper code into:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandButton10_Click()
  2. fileToOpen = Application _
  3.     .GetOpenFilename("XML Files (*.xml), *.xml")
  4. ActiveWorkbook.XmlImport(Data:=fileToOpen,ImportMap:=Estimate)
  5. End Sub
May 7 '07 #1
Share this Question
Share on Google+
1 Reply


SammyB
Expert 100+
P: 807
I have an excel/vba project I've been working on and run into some trouble importing a xml file to my workbook. The existing xmlmap is valid and the xml file imports when using the import xml under the Data dropdown menu however it fails to import using the vbs script I've written. I use the default schema as the xmlmap is very simple and have come across a page from microsoft here that mentions that I have to unwrap certain objects when the ExcelLocale1033Attribute is set to true. The syntax however, eludes me. Here's what I'd like to insert the proper code into:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandButton10_Click()
  2. fileToOpen = Application _
  3. .GetOpenFilename("XML Files (*.xml), *.xml")
  4. ActiveWorkbook.XmlImport(Data:=fileToOpen,ImportMap:=Estimate)
  5. End Sub
Your reference only applies to .NET applications. You won't need to do any of this in VBA. Two suggestions:
  1. Look at the return code from XmlImport
  2. Provide a destination range (the upper-left corner) parameter for XmlImport
May 7 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.