G
Guest
Hi
I am trrying to open a spreadsheet in excel from form command button but
when I run I get message object variable or with block variable not set
code as follows where am I going wrong?
Thanks
Tina
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
Dim oApp As Object
Dim MYSPREADSHEET As String
Dim xlW, xlApp As Object
MYSPREADSHEET = "L:\SYMDATA\TINA\QA\CHEM.XLS"
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
Set xlW = xlApp.WORKBOOKS.Open(MYSPREADSHEET)
'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command19_Click
End Sub
I am trrying to open a spreadsheet in excel from form command button but
when I run I get message object variable or with block variable not set
code as follows where am I going wrong?
Thanks
Tina
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
Dim oApp As Object
Dim MYSPREADSHEET As String
Dim xlW, xlApp As Object
MYSPREADSHEET = "L:\SYMDATA\TINA\QA\CHEM.XLS"
Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
Set xlW = xlApp.WORKBOOKS.Open(MYSPREADSHEET)
'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Command19_Click
End Sub