this is a bit cut down from what I actually use but should work:
Sub ScriptPrintButton()
Dim docpath, docname As String
Dim QtyToPrint As Integer
docpath = "\\PHARM-SVR\AJSM\ajs svr\scripts\approved\"
rem [document] is the document file name stored in a field on the form
docname = docpath & [Document]
rem [qty] is the number to print stored in a field on the form
QtyToPrint = [qty]
Set oApp = New Word.Application
oApp.Visible = False
oApp.Documents.Open Filename:=docname, ReadOnly:=True
you get problems with word being visible and word printing messages even if you set the app.visible to false. works better if you create a document object to print and make that invisible as well. but can't get away from word printing messages ... which are a pain if you're printing hundreds of copies like we do.
make sure to put in word in references.
hope this helps
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.