Results 1 to 2 of 2
  1. #1
    Hobbes29 is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    10

    Open a specific Excel application in Access

    I'm looking for assistance please.

    I have a sub routine in Access that opens an instance of Excel. However I can hard code the path to the Excel file and it works fine, but I want to have a file dialog box open up and the user selects the path. Once the code is ran, I want the user to navigate to the location where the Excel file resides.




    Here is what I have

    Code:
        Dim xlApp as Object
        Dim sDialog as String
     
        set xlApp = CreateObject("Excel.Application")
     
       'This works, but...
       sDialog = "c:\mypath\myfileDir\file.xlsx"   
     
       'I want...
       sDialog = <user selected path>
     
       with xlApp
           xlApp.WorkBooks.Open (sDialog)
           xlApp.Visible = true
        End With
     
    set xlApp = Nothing
    Thanks for any help with this.

    Ken

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can use a method like this to open the file browser for the user to select the file:

    http://www.mvps.org/access/api/api0001.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Import Specific Cells from Excel to Access
    By Evocube in forum Import/Export Data
    Replies: 2
    Last Post: 01-12-2012, 10:35 AM
  2. Replies: 1
    Last Post: 11-21-2010, 10:26 PM
  3. Replies: 0
    Last Post: 08-26-2008, 09:22 AM
  4. Access application to Web based application
    By admaldo in forum Access
    Replies: 0
    Last Post: 06-12-2008, 06:22 AM
  5. Open Excel from within Access?
    By kjw in forum Access
    Replies: 2
    Last Post: 04-08-2008, 07:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums