Windows Vista Forums

How do i open Excel 2003 or 2007 from VBS

  1. #1


    RedV Guest

    How do i open Excel 2003 or 2007 from VBS

    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 that?

      My System SpecsSystem Spec

  2. #2


    Richard Mueller [MVP] Guest

    Re: How do i open Excel 2003 or 2007 from VBS


    "RedV" <RedV@newsgroup> wrote in message
    news:860341B7-8D6F-4227-8361-F6135080CDA1@newsgroup

    >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
    > that?
    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:
    =============
    Option Explicit
    Dim objExcel, objWorkbook

    Set objExcel = CreateObject("Excel.Application")

    ' Open either 2003 or 2007 version Excel spreadsheet.
    ' objExcel.Workbooks.Open "C:\Scripts\Example.xls"
    objExcel.Workbooks.Open "C:\Scripts\Example.xlsx"

    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

    ' Clean up.
    objExcel.ActiveWorkbook.Close
    objExcel.Application.Quit

    --
    Richard Mueller
    MVP Directory Services
    Hilltop Lab - http://www.rlmueller.net
    --



      My System SpecsSystem Spec

How do i open Excel 2003 or 2007 from VBS

Similar Threads
Thread Forum
Excel 2007 Crashes Upon Open
I'm running Vista x64 with SP2 installed. I am using Office 2007 - Student and Home. Whenever I open Excel 2007, it automatically hangs/freezes over...
Software
Specify open file with Excel 2007
I have both Office 2003 and 2007 dual installed on my PC. I need to point my script to open certain files using 2007, but it defaults to 2003. Can...
VB Script
Excel 2007 cannot open file under Vista Business
When I double-click to open an Excel file, I get the message: "Windows cannot find 'C:\xxx\xxxxx\somefile.xls'. Make sure you typed the name...
Vista General
Can't open Excel 2007 with double click
I repaired and uninstalled then installed Office 2007. I opened Excel up and search for my Excel Spread Sheet and open it and then save as on my...
Vista General
office excel 2007 & 2003 on same computer?
we have microsoft office excel 2007 installed on our computer, however we like the older version 2003 better. are we able to load both on the same...
Software
Excel 2007 display shift when open file in explorer
Trouble I encountered.... When double clicking a xls file in explorer, up comes excel 2007 in full screen, but that the whole screen would shift...
Vista General
Excel 2007 wil not open and Excel 2007 document in Vista?
When I try to open an Excel 2003 document I get this error "access denied - contact your administrator". I have checked and the document that is...
Vista General