Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2005
    Posts
    113

    Unanswered: Opening an excel file

    How do I open an excel using access from a button in a form?

    Regards,
    Julita

  2. #2
    Join Date
    Apr 2006
    Location
    Huddersfield, UK
    Posts
    154
    what do you want to do open an external xls file or export data form access to excel?
    sometimes simple is best.... and i'm just a simple fellow.

  3. #3
    Join Date
    Nov 2005
    Posts
    113
    I've already exported data to an excel file that I would like to open.

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    You might like to try running a shell command:

    Shell "Start <path to file>"

    Or something along those lines... not sure anymore as I currently use an API to do this. I'll paste it all up when I get more time if you haven't worked it out by then.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    You can use Excel object to open an existing Excel file
    go to the preferences and include the MS Excel 11 object library

    You can try the following code:

    PHP Code:
    Dim xlApp,  XlWrkBook 

    set xlApp 
    = new Excel.Application
    XlApp
    .Visible True

    Set XlWrkBook 
    xlApp.Open(yourFileNameWithFullPath
    Then you can do whatever you want in the opened file

    At the end don't forget to set the variable objects to NOTHING








  6. #6
    Join Date
    Nov 2005
    Posts
    113
    Thank you. I needed to change a bit, like this, before it worked

    Dim xlApp

    Set xlApp = New Excel.Application
    xlApp.Visible = True

    Set xlApp = Workbooks.Open("C:\Documents and Settings\Administratör\Skrivbord\_PederNarkloggExc elFel\Test.xls")

    With regards Julita

  7. #7
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Nice that it worked....

Posting Permissions

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