G
Guest
Greetings,
I have a document management MS Access database based on a downloadable
wizard (Arvin Meyer 1999). I’ve modified it to list all files in a folder
that are .doc, .xls, .pdf, .pub.
I have check boxes for the user to select multiple files (there can be up to
75 documents listed on the form). In VBA I processes each file selected and
print the documents calling the function listed.
This works fine as long as it’s a Word doc.
Question is: can this function be modified for Excel, Publisher and Adobe?
Its base on code I found somewhere a couple years ago and have been using it
in a another document management Access pgm that only used .doc files.
Function PrintWordDoc(strWD As String, strFileSpec As String, Duplex As
Boolean)
'strWD is name of document to print. (not used)
'str FileSpec is the path to and includes the doc,
‘Duplex is true for double sided docs (also not used)
Dim objWordDoc As Object
Set objWordDoc = CreateObject("Word.basic")
On Error Resume Next 'Close the doc - if not open, use error as skip
objWordDoc.fileclose 2
objWordDoc.FileOpen strFileSpec
On Error GoTo Err_PrintWordDoc 'set true error response
objWordDoc.fileprint , , , , , Pages:="1"
'response = MsgBox("OK!", vbOKOnly)
Exit_PrintWordDoc:
On Error Resume Next 'Again if not open, let error response=resume
objWordDoc.fileclose 2
Set objWordDoc = Nothing
Exit Function
Err_PrintWordDoc:
MsgBox Err.Description
Resume Exit_PrintWordDoc
End Function
Appreciate any suggestions,
Jael
I have a document management MS Access database based on a downloadable
wizard (Arvin Meyer 1999). I’ve modified it to list all files in a folder
that are .doc, .xls, .pdf, .pub.
I have check boxes for the user to select multiple files (there can be up to
75 documents listed on the form). In VBA I processes each file selected and
print the documents calling the function listed.
This works fine as long as it’s a Word doc.
Question is: can this function be modified for Excel, Publisher and Adobe?
Its base on code I found somewhere a couple years ago and have been using it
in a another document management Access pgm that only used .doc files.
Function PrintWordDoc(strWD As String, strFileSpec As String, Duplex As
Boolean)
'strWD is name of document to print. (not used)
'str FileSpec is the path to and includes the doc,
‘Duplex is true for double sided docs (also not used)
Dim objWordDoc As Object
Set objWordDoc = CreateObject("Word.basic")
On Error Resume Next 'Close the doc - if not open, use error as skip
objWordDoc.fileclose 2
objWordDoc.FileOpen strFileSpec
On Error GoTo Err_PrintWordDoc 'set true error response
objWordDoc.fileprint , , , , , Pages:="1"
'response = MsgBox("OK!", vbOKOnly)
Exit_PrintWordDoc:
On Error Resume Next 'Again if not open, let error response=resume
objWordDoc.fileclose 2
Set objWordDoc = Nothing
Exit Function
Err_PrintWordDoc:
MsgBox Err.Description
Resume Exit_PrintWordDoc
End Function
Appreciate any suggestions,
Jael