Batch file to open an xls file in an older version of Excel

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
riddler266
Posts: 1
Joined: 29 May 2012 05:05

Batch file to open an xls file in an older version of Excel

#1 Post by riddler266 » 29 May 2012 05:12

Everyday I have to FTP a file from the mainframe to a txt file (and have the batch file for this ok) then I need to open excel and run a macro to convert the file to a DBF file for another system to use.

The problem is that we have updated to Office 2010 and you can't save as DBF anymore! So I've installed Excel 97 as well and can manually open this, then run the macro to convert the txt file into a dbf.

What I would like is to have my batch file, open the file in the OLD version of excel, then auto run the macro - is this possible?

I've got it so far so it WILL open the old version, but then I have to File Open myself - if I try to link the file, it just opens it in 2010.

Thanks if anyone has any suggestions

Rob

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Batch file to open an xls file in an older version of Ex

#2 Post by abc0502 » 29 May 2012 09:00

Use this command:
@echo off
cls
set "OldExcel=put the excel.exe path here"
set "FilePath=put the file location u want to open here"
start "" "%OldExcel%" "%FilePath%"

it should work i use it with notepad++ to open a certain files when i run one of my batch files

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Batch file to open an xls file in an older version of Ex

#3 Post by foxidrive » 30 May 2012 00:03

Right click the excel file and then in the "Open With" menu, navigate to the excel 97 executable. Select always use this program and it will then open Excel 97, hopefully.

Post Reply