If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > How can I get macro to ask for XML file location when refreshing data import?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-17-07, 15:51
CasparV CasparV is offline
Registered User
 
Join Date: Jul 2007
Posts: 54
How can I get macro to ask for XML file location when refreshing data import?

I have Excel 2003 and have written a macro to manipulate some data which I import from an XML file via a customised map.

To refresh the data I have a line in my macro which says:

ActiveWorkbook.XmlMaps("MyMap").Import URL:= "C:\Path\filename.xml"

Now this works just fine except that I wish it would pop up an explorer dialogue box asking me exacly which xml file I want to import from which folder (starting from the C:\Path\ location).

I have other macros that import csv or text files and that is what they do, but I can't find the same options with xml.

Can someone tell me how to solve this aggravation, please?

Thanks,
Caspar
Reply With Quote
  #2 (permalink)  
Old 09-18-07, 03:34
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
Hi

You could try this or similar but with .xml file spec and your annotation etc.

Dim FileName as String
FileName = Application.GetOpenFilename("Timesheets Consolidation (*.xls),*.xls", , "Select Consolidation Sheet to Use")

Excel help for GetOpenFilename gives you all the info on how to use this method.

Is that what you had in mind?

MTB
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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