Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Excel from Access Using Command Button 2

Status
Not open for further replies.

woodlandstx

Technical User
Apr 26, 2004
47
US

I have looked at the previous posts and have this currently:

Private Sub Command33_Click()

Dim stAppName As String, stFile As String

stAppName = "c:\Program Files\Microsoft Office\Office\excel.xls"
stFile = "f:\Proposal Database\Statistics Complete Pages.xls"

Call Shell(stAppName & " " & stFile, 1)

I have tried switching the appname and stfile
and I am still getting the
Run Time Error 53
File not found

I have looked at different postings for this, but none are really different...?

Thanks!~
 
Code:
Private Sub Command33_Click()

    Dim stAppName As String, stFile As String
    
    stAppName = "c:\Program Files\Microsoft Office\Office\excel.[red]xls[/red]"
    stFile = "f:\Proposal Database\Statistics Complete Pages.xls"
    
    Call Shell(stAppName & " " & stFile, 1)

Change the "excel.xls" to "excel.exe" and I think you're good.


Pete
(just a few miles up the road in) Huntsville, TX
 
I think you also need to use quotes around those directory and filename with embedded spaces.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Yeah, let me edit that:
Code:
I have looked at the previous posts and have this currently:

Private Sub Command33_Click()

    Dim stAppName As String, stFile As String
    
    stAppName = """c:\Program Files\Microsoft Office\Office\excel.exe"""
    stFile = """f:\Proposal Database\Statistics Complete Pages.xls"""
    
    Call Shell(stAppName & " " & stFile, 1)
End sub
 


Thanks!!! That was the problem....you'd think after staring at it for an hour....lol

Thanks!~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top