How can I always know the exact path to Excel.exe?

hollifd

Board Regular
Joined
Apr 3, 2002
Messages
248
I have asked this same question on the Access board. I hope I am not violating any forum rules.

If I wanted to open Excel.exe on a user's machine, how can I know the exact path to the Excel.exe file.

I want to open Excel.exe from a batch file like:

C:\Program Files\Microsoft Office\Office11\Excel.exe

but the path may be different for some users. It could be Office10 or some other difference.

What VBA code can I use in order to always know the correct path to the latest version of Excel or Access?

Thanks,

David
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
if I mis-remember, you should be able to simply enter a command of
Code:
shell excel.exe
Theoretically, the location of the exceutable is "pathed" so it is equivalent to the "Root directory". An example, here are all of the directories that are "Pathed" on my machine... notice that the directory containg excel is in the list (actually first in the list):

Path=C:\Program Files\Microsoft Office\OFFICE11\;C:\Program Files\CA\Dcs\DMScripting\;C:\Program Files\CA\DCS\CAWIN\;C:\Program Files\Intel\Fortran\compiler80\IA32\BIN;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\Program Files\Bin;C:\Program Files\Winzip;C:\WINDOWS\SYSTEM32\WBEM;K:\PROD\Share\Bin;K:\PROD\WNT\Bin;C:\Oracle\920\bin;C:\Oracle\920\jre\1.4.2\bin\client;C:\Oracle\920\jre\1.4.2\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\SYSMGT\CA_APPSW\VIRUSSCAN;C:\SYSMGT\TNGEAV;C:\Oracle\EIS\BIN;C:\Oracle\EIS\jdk\bin;C:\Program Files\IBM\Client Access;C:\Program Files\IBM\Client Access\Shared;C:\Program Files\IBM\Client Access\Emulator;C:\Program Files\STRATEGY\bin;K:\PROD\WNT\LIB;C:\PERL\V58\bin;C:\SYSMGT\TNGSD\BIN;C:\Program Files\CA\SharedComponents\CAM\bin;C:\Program Files\Hummingbird\Connectivity\7.10\Accessories\
 

hollifd

Board Regular
Joined
Apr 3, 2002
Messages
248
Thanks hatman,

That is a very funny picture. I get a chuckle every time I look at it.

My problem is much bigger than I originally stated. I am currently working with Norie on the Access forum to try to solve my bigger problem. Thanks for the reply.

David
 

Forum statistics

Threads
1,141,681
Messages
5,707,795
Members
421,528
Latest member
datdude151

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
Top