Hello I am opening a word document and capturing the use of the print button with the following Code.
I have the class -
VB Code:
Option Explicit Public WithEvents objWord As Word.Application Private Sub objWord_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean) frmApplication.txtLetterPrinted.Text = "Yes" End Sub
And I use this in a form -
VB Code:
Set objPrintDoc.objWord = CreateObject("Word.Application") With objPrintDoc.objWord .Documents.Add Template:=strDocName .ActiveDocument.MailMerge.OpenDataSource App.Path & "\addlist.txt", ReadOnly:=True .ActiveDocument.MailMerge.MainDocumentType = wdFormLetters .ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False .Visible = True .Application.WindowState = wdWindowStateMaximize End With
When i Was opening a .doc file, this worked fine, but I am now opening a .dot file and it has stopped working. Does anybody know why and can I fix it?
Kev.![]()
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. " - Abert Einstein




Reply With Quote