I am creating a word document on the fly and I am trying to use the Word Print field to send PCL code to the printer. However, when I try this the printer does not seem to respond to the codes that are sent. If I manually modify the document that was created through my automation process, it also does not work. If I create a brand new document and send it the printer commands, it works perfectly. So I think it is an issue with the document I am creating.
Has anyone run into this before?
Here is the code I use to create the print field:
VB Code:
m_App.Selection.Fields.Add(Range:=m_App.Selection.Range, Type:=Word.WdFieldType.wdFieldEmpty, Text:= _ "PRINT 27""&l2S""", PreserveFormatting:=False)
And here is the code I use to create a new document:
VB Code:
Public Sub New() m_App = New Word.Application m_Doc = m_App.Documents.Add End Sub
Any advice would be greatly appreciated.


Reply With Quote