"RedV" <RedV@newsgroup> wrote in message
>I have both 2003 and 2007 installed on my machine. I want to create a VB
> Script to open a few files in 2003 and in 2007 versions. How can i do
VBScript code similar to below should work for either version, as long as
the 2007 version is installed on the computer where you run the script:
Dim objExcel, objWorkbook
Set objExcel = CreateObject("Excel.Application")
' Open either 2003 or 2007 version Excel spreadsheet.
' objExcel.Workbooks.Open "C:\Scripts\Example.xls"
Set objWorkbook = objExcel.ActiveWorkbook.Worksheets(1)
' Display some specific cell values.
Wscript.Echo objWorkbook.Cells(1, 1).Value
Wscript.Echo objWorkbook.Cells(1, 2).Value
Wscript.Echo objWorkbook.Cells(2, 1).Value
Wscript.Echo objWorkbook.Cells(2, 2).Value
Windows Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows 10" and related materials are trademarks of Microsoft Corp.