I am using the Code listed below in Access 2000 with a Command Button to Open Word, Open a Document and then run a Word Macro.
Private Sub Command7_Click()
On Error GoTo Err_OpenGuide
Dim Oapp As Object
Set Oapp = CreateObject("Word.Application")
Oapp.Documents.Add "C:\Divisions\PrintOut.doc"
Oapp.Run "PrintOut"
ActiveDocument.ActiveWindow.Close
Set Oapp = Nothing
Exit_OpenGuide:
Exit Sub
Err_OpenGuide:
MsgBox Err.Description
Resume Exit_OpenGuide
End Sub
The problem is when I have created a Second Command Button( to open another Doc. File) with the following Code,
Private Sub cmdReport_Click()
Call ReportCreation(Me![cboDiv], Me![cboBuyer])
On Error GoTo Err_OpenGuide
Dim Oapp As Object
Set Oapp = CreateObject("Word.Application")
Oapp.Documents.Add "C:\Divisions\Report.doc"
Oapp.Run "PrintOut"
ActiveDocument.ActiveWindow.Close
Set Oapp = Nothing
Exit_OpenGuide:
Exit Sub
Err_OpenGuide:
MsgBox Err.Description
Resume Exit_OpenGuide
End Sub
The Macro did not run. The Document did open.
I sure could use some help with this.
Thanks
Jack
Private Sub Command7_Click()
On Error GoTo Err_OpenGuide
Dim Oapp As Object
Set Oapp = CreateObject("Word.Application")
Oapp.Documents.Add "C:\Divisions\PrintOut.doc"
Oapp.Run "PrintOut"
ActiveDocument.ActiveWindow.Close
Set Oapp = Nothing
Exit_OpenGuide:
Exit Sub
Err_OpenGuide:
MsgBox Err.Description
Resume Exit_OpenGuide
End Sub
The problem is when I have created a Second Command Button( to open another Doc. File) with the following Code,
Private Sub cmdReport_Click()
Call ReportCreation(Me![cboDiv], Me![cboBuyer])
On Error GoTo Err_OpenGuide
Dim Oapp As Object
Set Oapp = CreateObject("Word.Application")
Oapp.Documents.Add "C:\Divisions\Report.doc"
Oapp.Run "PrintOut"
ActiveDocument.ActiveWindow.Close
Set Oapp = Nothing
Exit_OpenGuide:
Exit Sub
Err_OpenGuide:
MsgBox Err.Description
Resume Exit_OpenGuide
End Sub
The Macro did not run. The Document did open.
I sure could use some help with this.
Thanks
Jack