1

The Problem is an excel file on a network drive which is to be opened from a .cmd file in the same folder. As I'd rather not tamper with the registry on a machine at work, I used the pushd command to switch to the directory and open the file. Unfortunately pushd maps the path to a temporary drive letter which usually does not exist anymore when I save the excel file. Of course I could just use save-as and select the network path, yet it is rather tedious doing this on a daily basis.

Question(s):

Is there a way to circumvent the drive letter mapping and open the excel file from cmd on the network path without touching the registry?

Or, which seems more probable, is there a way to change the saving path of the excel file automatically to the required network path? I assume you could change some variable onWorkbookOpen, yet I don't know which...

Just in case, here's the batch code...

pushd \\%~P0
START excel.xlsm
Community
  • 1
  • 1
karuit
  • 31
  • 3
  • 1
    I would advise you not to use `START`. That way, your batch script won't exit before you close the excel file and the mapped drive will still be available – J.Baoby Mar 02 '17 at 19:21

0 Answers0