Avatar of garbertravel
garbertravel
 asked on

batch command open excel 2003 and not 2007

I am trying to create a batch file that will launch a file in excel 2003 on machine that is running both excel 2003 and 2007
Microsoft DOSWindows Batch

Avatar of undefined
Last Comment
Klitos

8/22/2022 - Mon
Bartender_1

Have you tried using the entire path to specify the executable?

start "C:\Program Files\Microsoft Office\OFFICE11\excel.exe" "c:\<path>\<filename>.xls"

(rename the path and filename as appropriate.)

Hope this helps!

:o)

Bartender_1
garbertravel

ASKER
I tried that and it still launches Excel launched Excel 2007.
Bartender_1

Does it open Excel 2007 if you just use

start "C:\Program Files\Microsoft Office\OFFICE11\excel.exe"
?

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
garbertravel

ASKER
It does. but if I click on that file it runs on 2003. I don't because I just did a test with word and it launched 2003 fine.
Bartender_1

Can you double check where the executable for Excel 2003 is? It sounds as if the path is pointing to Excel 2007.
garbertravel

ASKER
2003 points to:
C:\Program Files\Microsoft Office\OFFICE11

2007 points to:
C:\Program Files\Microsoft Office\Office12
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Bartender_1

Is Excel set to be the default spreadsheet software?

If you click start, then run, and just type "excel" and click ok, which program opens?
doublestick

I assume you are doing this on a local machine (not remote)...

If you are doing this on a local machine, you will want to temporarily associate the filetype with a certain program (Office2003) to open the file, then re-associate the filetype back to the original program (Office2007).

To do this, you would use "FTYPE"
From a CMD prompt, type FTYPE to display all current associations. (Be quick with the pause button or you will miss the beginning of the list)
If you use something like this in your .BAT file it should work.

Just open notepad, put the following in, then SAVE AS a .bat file.

:top
c:
cd\
ftype Excel.Chart="C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" /e
"c:\directory\(ExcelFilename)"
ftype Excel.Chart="C:\Program Files\Microsoft Office\OFFICE12\EXCEL.EXE" /e



Hope that at least gets you in the right direction. You may need to associate a different file then in my example, but you should be able to see what it is called when you look at FTYPE in the cmd window.

-Chris

ASKER CERTIFIED SOLUTION
Klitos

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question