I am trying to print a specific Excel file from an Access Form Button and am having problems with the VBA Code.
Also, I am trying to open a specific Excel file from Acesss. I can do it with Word, but am somehow missing the conversion to excel.
Private Sub Open_Word_File_to_Print_Click()
On Error GoTo Err_Open_Word_File_to_Print_Click
Dim objWord As Object 'Word.Document
Dim objstr As String
objstr = "d:\data\word\hw2.doc"
Set objWord = GetObject(objstr, "Word.Document"
objWord.Application.Visible = True
objWord.Application.Documents.Open FileName:=objstr
'Only XL 97 supports UserControl Property
On Error Resume Next
objWord.UserControl = True
Exit_Open_Word_File_to_Print_Click:
Exit Sub
Err_Open_Word_File_to_Print_Click:
MsgBox Err.Description
Resume Exit_Open_Word_File_to_Print_Click
End Sub
Thanks in advance for the help
Also, I am trying to open a specific Excel file from Acesss. I can do it with Word, but am somehow missing the conversion to excel.
Private Sub Open_Word_File_to_Print_Click()
On Error GoTo Err_Open_Word_File_to_Print_Click
Dim objWord As Object 'Word.Document
Dim objstr As String
objstr = "d:\data\word\hw2.doc"
Set objWord = GetObject(objstr, "Word.Document"
objWord.Application.Visible = True
objWord.Application.Documents.Open FileName:=objstr
'Only XL 97 supports UserControl Property
On Error Resume Next
objWord.UserControl = True
Exit_Open_Word_File_to_Print_Click:
Exit Sub
Err_Open_Word_File_to_Print_Click:
MsgBox Err.Description
Resume Exit_Open_Word_File_to_Print_Click
End Sub
Thanks in advance for the help