open excel file automaticallty via access btn

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BankGirl
    New Member
    • Jan 2008
    • 5

    open excel file automaticallty via access btn

    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 cmdOpenExcelFil e_Click()
    Dim stAppName As String

    stAppName = "h:\sue\bdrm\FB T Fleet\access\FB TDataFleetColle ction.xls"

    Call Shell(stAppName , 1)

    End Sub
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Try the application.fol lowhyperlink method instead

    Code:
     
    Dim stAppName as string
    stAppName = "h:\sue\bdrm\FBT Fleet\access\FBTDataFleetCollection.xls"
    application.FollowHyperlink stAppName
    Regards

    Jim

    Comment

    • Stewart Ross
      Recognized Expert Moderator Specialist
      • Feb 2008
      • 2545

      #3
      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 cmdOpenExcelFil e_Click()
      Dim stAppName As String

      stAppName = "h:\sue\bdrm\FB T Fleet\access\FB TDataFleetColle ction.xls"

      Call Shell(stAppName , 1)

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

      Code:
      Call Shell ("Excel " & stAppName, 1)
      It works for me.

      Cheers

      Stewart

      Comment

      Working...