B
Bill Billmire
I have some VBScript (in an Outlook Form), that calls
"CreateObject("Word.Application"). The script processes some data then at
the end of the procedure prints out the result. This works fine on my local
machine, however, if another user attempts the same process it does not print
the output.
Ref: [msgbox "Printing to " & objWord.ActivePrinter] below...
I added the msgbox, and now verified that on each machine the correct
printer is configured (or displayed) in the msgbox. But, the form does not
print. What I observe is; the item shows up in the respective printer
queue(s) (but only for a very brief second) then vanishes and nothing
prints... Suggestions/comments?
Current working code (except printing on other machines...)
'----------------------Printing Routine------------------------
Dim objWord
Dim strTemplate
Dim strField
Dim strField1
Dim objDoc
Dim objMark
Dim mybklist
Dim counter
Sub cmdPrint_Click()
Item.Save
Set objWord = CreateObject("Word.Application")
' Put the name of the Word template that contains the bookmarks
strTemplate = "OSR.dot"
' Location of Word template; could be on a shared LAN
strTemplate = "\\ivory\forms\" & strTemplate
Set objDoc = objWord.Documents.Add(strTemplate)
Set mybklist = objDoc.Bookmarks
For counter = 1 to mybklist.count
Set objMark = objDoc.Bookmarks(counter)
strField = objMark.Name
If strField = "SentField" then
strField1 = CStr(Item.SentOn)
Else
strField1 = Item.UserProperties(strField)
End If
objMark.Range.InsertBefore strField1
Next
msgbox "Printing to " & objWord.ActivePrinter
objDoc.PrintOut
objWord.Quit(0)
End Sub
Thanks VERY much, in advance!
Bill Billmire -
"CreateObject("Word.Application"). The script processes some data then at
the end of the procedure prints out the result. This works fine on my local
machine, however, if another user attempts the same process it does not print
the output.
Ref: [msgbox "Printing to " & objWord.ActivePrinter] below...
I added the msgbox, and now verified that on each machine the correct
printer is configured (or displayed) in the msgbox. But, the form does not
print. What I observe is; the item shows up in the respective printer
queue(s) (but only for a very brief second) then vanishes and nothing
prints... Suggestions/comments?
Current working code (except printing on other machines...)
'----------------------Printing Routine------------------------
Dim objWord
Dim strTemplate
Dim strField
Dim strField1
Dim objDoc
Dim objMark
Dim mybklist
Dim counter
Sub cmdPrint_Click()
Item.Save
Set objWord = CreateObject("Word.Application")
' Put the name of the Word template that contains the bookmarks
strTemplate = "OSR.dot"
' Location of Word template; could be on a shared LAN
strTemplate = "\\ivory\forms\" & strTemplate
Set objDoc = objWord.Documents.Add(strTemplate)
Set mybklist = objDoc.Bookmarks
For counter = 1 to mybklist.count
Set objMark = objDoc.Bookmarks(counter)
strField = objMark.Name
If strField = "SentField" then
strField1 = CStr(Item.SentOn)
Else
strField1 = Item.UserProperties(strField)
End If
objMark.Range.InsertBefore strField1
Next
msgbox "Printing to " & objWord.ActivePrinter
objDoc.PrintOut
objWord.Quit(0)
End Sub
Thanks VERY much, in advance!
Bill Billmire -