Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports

Results 1 to 1 of 1

Thread: Open an Excel workbook from MS Access

  1. #1
    Join Date
    28th January 2003
    Solihull - England
    Ok, this is nothing really new, however it does seem to be quite a common question, so for want of another better place to put it.

    This code will run from a normal command button placed on an Access form

    Private Sub CmdOpenExcel_Click() 
         'WillR - opens the specified Spreadsheet
        Dim xlApp As Excel.Application 
        Dim xlWB As Excel.Workbook 
        Set xlApp = New Excel.Application 
        With xlApp 
            .Visible = True 
            Set xlWB = .Workbooks.Open("R:\path\path2\path3\xlfilename.xls", , False) 
        End With 
    End Sub 
    Hope it helps - I have found it useful.

    NB: You will need to set a reference to the Excel Object Library in the Visual Basic Editor in MS Access.

    To do this,

    Open the Access VBE (ALT + F11)
    Go to Tools|References
    Check the box next to the relevant Excel Library (for example Microsoft Excel 9.0 Object Library if using Office 2000)
    Click OK
    Last edited by Will Riley; May 25th, 2004 at 18:27.
    Kind Regards, Will Riley

    LinkedIn: Will Riley

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Replies: 21
    Last Post: September 13th, 2007, 04:27
  2. Open MS Access from Excel
    By quickoats in forum Excel and/or Access Help
    Replies: 3
    Last Post: September 16th, 2004, 23:44


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts