Access Form command button, run excel file

  • Thread starter Thread starter kuslusr1
  • Start date Start date
K

kuslusr1

I trying to set up a Main Form command button that will allow end users to
open an Excel file "W:\Public Access Folders\Misc\SURFACE DEPARTMENT MAXIMO
REPORTS\Availability Calculator.xls". I have tried a few different methods
that I found in the Community Forum with no luck. Hoping someone might have a
procedure example that would work for me.
 
I trying to set up a Main Form command button that will allow end users to
open an Excel file "W:\Public Access Folders\Misc\SURFACE DEPARTMENT MAXIMO
REPORTS\Availability Calculator.xls". I have tried a few different methods
that I found in the Community Forum with no luck. Hoping someone might have a
procedure example that would work for me.

Application.FollowHyperlink "W:\Public Access Folders\Misc\SURFACE
DEPARTMENT MAXIMO REPORTS\Availability Calculator.xls"
 
I was using the following code to open Excel:
Private Sub Command449_Click()
On Error GoTo Err_Command449_Click
Dim oApp As Object
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True
Exit_Command449_Click:
Exit Sub
Err_Command449_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command449_Click
End Sub

How to I apply the code provided below to open the identified excel file.

Application.FollowHyperlink "W:\Public Access Folders\Misc\SURFACE
DEPARTMENT MAXIMO REPORTS\Availability Calculator.xls"
 
I was using the following code to open Excel:
Private Sub Command449_Click()
On Error GoTo Err_Command449_Click
Dim oApp As Object
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True
Exit_Command449_Click:
Exit Sub
Err_Command449_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command449_Click
End Sub

How to I apply the code provided below to open the identified excel file.

Application.FollowHyperlink "W:\Public Access Folders\Misc\SURFACE
DEPARTMENT MAXIMO REPORTS\Availability Calculator.xls"


Private Sub Command449_Click()
On Error GoTo Err_Command449_Click

Application.FollowHyperlink "W:\Public Access Folders\Misc\SURFACE
DEPARTMENT MAXIMO REPORTS\Availability Calculator.xls"

Exit_Command449_Click:
Exit Sub
Err_Command449_Click:
MsgBox "Error #: " & Err.Number & " " & Err.DESCRIPTION
Resume Exit_Command449_Click
End Sub


Note: the code should be all on one line.
Also, I've added the error number to your Error handling code. Often
times the error number is more important than the error description.
 
Back
Top