By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,037 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,037 IT Pros & Developers. It's quick & easy.

open excel file automaticallty via access btn

P: 5
hi i am trying to open a excel spreadsheet automatically at the push of a button. i am using the below code that i obtained via another help message but i keep getting an error message saying 'runtime error 5, invalid procedure or call arguement???

can someone help me out?

Private Sub cmdOpenExcelFile_Click()
Dim stAppName As String

stAppName = "h:\sue\bdrm\FBT Fleet\access\FBTDataFleetCollection.xls"

Call Shell(stAppName, 1)

End Sub
Feb 13 '08 #1
Share this Question
Share on Google+
2 Replies


Jim Doherty
Expert 100+
P: 897
Try the application.followhyperlink method instead

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim stAppName as string
  3. stAppName = "h:\sue\bdrm\FBT Fleet\access\FBTDataFleetCollection.xls"
  4. application.FollowHyperlink stAppName
  5.  
Regards

Jim
Feb 13 '08 #2

Expert Mod 2.5K+
P: 2,545
hi i am trying to open a excel spreadsheet automatically at the push of a button. i am using the below code that i obtained via another help message but i keep getting an error message saying 'runtime error 5, invalid procedure or call arguement???

can someone help me out?

Private Sub cmdOpenExcelFile_Click()
Dim stAppName As String

stAppName = "h:\sue\bdrm\FBT Fleet\access\FBTDataFleetCollection.xls"

Call Shell(stAppName, 1)

End Sub
Hi. Shell needs to know what application to launch - try this in place of your Call statement

Expand|Select|Wrap|Line Numbers
  1. Call Shell ("Excel " & stAppName, 1)
It works for me.

Cheers

Stewart
Feb 13 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.