import xml file with VBA in excel

big_stu

New Member
Joined
Jun 1, 2016
Messages
4
Hello everyone,

first off thanks for all the posters who have unknowingly helped me with my excel vba experiments and projects thus far. I am slowly but surely building my VBA skills with all the useful info on this site.....but now im stuck and am appealing for help :D

I have a workbook with a xml map build in it which works great. I know how to import it manually, but would like to be able to import with vba code to simplify the operation for the masses.

the file path will always be on the desktop, but the NT login will change for each user.

I have a function built =Getdesktop() which successfully and correctly gets the users desktop.
File name to be opened is defined by a cell in the worksheet

concatenate function gives me the full file path e.g."C:\Users\joebloggs\desktop\INPLACE.xml"

the following code works for importing the file path above.

Sub import_file()
'
' import_file Macro
' import xml file

ActiveWorkbook.XmlMaps("LTI template").Import URL:= _
"C:Users\joebloggs\desktop\INPLACE.xml"

End Sub

can anyone point me in the right direction for substituting the fixed file path in the code for a file path derived from a named range in the workbook.

Regards,
Stu
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top