Open a specific Excel Spreadsheet

G

Guest

Hello.
I am using Access 2003 and I have created a button on a form using the
button wizard to open Excel, but I need it to open a particular spreadsheet
located at S:\Expenses\ExpenseForm.xls
Below is the default vba stuff in the Event Procedure for "On Click".
How do I modify it to open this specific spreadsheet?

Private Sub SPC_Form_Click()
On Error GoTo Err_SPC_Form_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_SPC_Form_Click:
Exit Sub

Err_SPC_Form_Click:
MsgBox Err.Description
Resume Exit_SPC_Form_Click

End Sub


Thanks.
Iram/mcp
 
F

fredg

Hello.
I am using Access 2003 and I have created a button on a form using the
button wizard to open Excel, but I need it to open a particular spreadsheet
located at S:\Expenses\ExpenseForm.xls
Below is the default vba stuff in the Event Procedure for "On Click".
How do I modify it to open this specific spreadsheet?

Private Sub SPC_Form_Click()
On Error GoTo Err_SPC_Form_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_SPC_Form_Click:
Exit Sub

Err_SPC_Form_Click:
MsgBox Err.Description
Resume Exit_SPC_Form_Click

End Sub

Thanks.
Iram/mcp

Private Sub SPC_Form_Click()
On Error GoTo Err_SPC_Form_Click

Application.FollowHyperlink "S:\Expenses\ExpenseForm.xls"

Exit_SPC_Form_Click:
Exit Sub

Err_SPC_Form_Click:
MsgBox Err.Description
Resume Exit_SPC_Form_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top