Automatically update path for linked xml

sandeepkhans

New Member
Joined
Feb 2, 2022
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi, I am new to using macros. I use xml mapped excel to extract flight planning information. However, when I send the excel and xml files through email to other users, the mapping link does not work obviously.
Is there any way so that when these files are loaded on a new machine, the updated file directory of the xml file is automatically updated in the macro as soon as the excel is opened on the new machine for the first time?

ActiveWorkbook.XmlMaps("FlightPlan_Map").Import Url:= _
C:\Users\Dell\Desktop\FPL_IL\XPS.txt
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hello. Off of the top of my head, you can accomplish this a few ways.

The easiest solution might be to mandate that the excel and xml file are saved in the same folder, and get the path of that folder with ThisWorkbook.Path. That way you can pick up the correct folder no matter where the user saves it.

Second, you could use a FileDialog to prompt the user to open the file (I am unsure if this will work on macOS or not). If you are interested, I can share a sample that I am using.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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