DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Open Excel sheet from Access

    [Originally posted by Jack]

    I want to open a specific excel file from a command button on an Access 97 form, I would be grateful for any advice. Thanks

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Open Excel sheet from Access

    [Originally posted by Santiago Linero]

    A way to do it is using "Shell"

    Shell ("excel.exe <complete path to file>.xls")

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Open Excel sheet from Access

    [Originally posted by Jack]

    I hate to sound thick but I am quite new to vba, due you think you could give me an example??? cheers Jack

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Open Excel sheet from Access

    [Originally posted by Santiago Linero]

    All right, you've got your Command Button in Access 97, and you're in design view. Right-click the button and select "Event" tag, "on-click" option. There you click the "..." button and the form code should appear. The code you need is:

    Private Sub Command8_Click()
    On Error GoTo Err_Command8_Click

    ÿ ÿ Dim oApp As Object

    Shell ("excel.exe C:\XX\Numbers.xls")

    Exit_Command8_Click:
    ÿ ÿ Exit Sub

    Err_Command8_Click:
    ÿ ÿ MsgBox Err.Description
    ÿ ÿ Resume Exit_Command8_Click
    ÿ ÿ
    End Sub


    Replace Command8 with your button name and the path and file name with yours.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:Open Excel sheet from Access

    [Originally posted by Jack]

    Cheers, thanks a lot I will give that a go. Jack

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links