RaunLGoode
Registered User.
- Local time
- Today, 14:47
- Joined
- Feb 18, 2004
- Messages
- 122
Upon returning from a vacation I was notified of a problem with a form in an Access file. I have a command button which is supposed to open an Excel workbook used as a data entry form. The Excel file has an "Auto Open" sub that clears the form upon opening the Excel file.
Here is the Subroutine:
Upon returning from Vacation I was notified of a problem with a form in an Access file. There is a command button which is supposed to open an Excel workbook with a data entry form. The Excel file has an "Auto Open" sub that clears the form. Here is the Subroutine:
Private Sub cmdAddDoc_Click()
'On Error GoTo Err_cmdAddDoc_Click
MsgBox "Opening the 'Project Entry' Spreadsheet"
Dim xlApp As Object
Set xlApp = GetObject("{path to File on Server}\2006_EngDB.xls")
'. RunAutoMacros Which:=xlAutoOpen
With xlApp
.Application.Visible = True
.Parent.Windows(1).Visible = True
End With
End Sub
There is a problem with the section of the code shown in green. If I try to run with the Green script I get a "compile error" "Invalid or unqualified reference. If I remark this part out, the Excel file opens, but seems to close down after the subroutine called in the Auto Open sub run, leaving only my "PERSONAL.xls" file open. I have been futzing around with off and on this for 2+ days
I think I have a syntax error, but I can't figure out what I am doing wrong. Could somebody with fresh eyes, or more experience than I have, help me find the error in my ways?
I am running Office 2003 /WinXP
Here is the Subroutine:
Upon returning from Vacation I was notified of a problem with a form in an Access file. There is a command button which is supposed to open an Excel workbook with a data entry form. The Excel file has an "Auto Open" sub that clears the form. Here is the Subroutine:
Private Sub cmdAddDoc_Click()
'On Error GoTo Err_cmdAddDoc_Click
MsgBox "Opening the 'Project Entry' Spreadsheet"
Dim xlApp As Object
Set xlApp = GetObject("{path to File on Server}\2006_EngDB.xls")
'. RunAutoMacros Which:=xlAutoOpen
With xlApp
.Application.Visible = True
.Parent.Windows(1).Visible = True
End With
End Sub
There is a problem with the section of the code shown in green. If I try to run with the Green script I get a "compile error" "Invalid or unqualified reference. If I remark this part out, the Excel file opens, but seems to close down after the subroutine called in the Auto Open sub run, leaving only my "PERSONAL.xls" file open. I have been futzing around with off and on this for 2+ days
I think I have a syntax error, but I can't figure out what I am doing wrong. Could somebody with fresh eyes, or more experience than I have, help me find the error in my ways?
I am running Office 2003 /WinXP
Last edited: