Hi All;
I am having an issue with some coding in Word VBA 2010. The goal is to run code when the word form is printed. I have three sections of code that I am trying to run if there are different types of printing that occur.
The form is locked. I'd like the form to unlock and shrink a button so that it has limited viability or is hidden when the file is printed. The code FilePrint_1 works just fine. The issue is that the call function is not occurring when the file is printed. This causes FilePrint_1 not to work.
Any ideas as what may be causing this code not to work?
I have tried to run the code without the form being locked and commenting out the lock / unlock process. This also didn't work.
Thanks for the help!
I am having an issue with some coding in Word VBA 2010. The goal is to run code when the word form is printed. I have three sections of code that I am trying to run if there are different types of printing that occur.
The form is locked. I'd like the form to unlock and shrink a button so that it has limited viability or is hidden when the file is printed. The code FilePrint_1 works just fine. The issue is that the call function is not occurring when the file is printed. This causes FilePrint_1 not to work.
Any ideas as what may be causing this code not to work?
I have tried to run the code without the form being locked and commenting out the lock / unlock process. This also didn't work.
Thanks for the help!
Code:
Sub FilePrint() 'File > Print
Call FilePrint_1
End Sub
Code:
Sub FilePrintDefault() ' Print Button
ActiveDocument.Unprotect Password:="logspec"
Call FilePrint_1
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, Noreset:=True, Password:="logspec"
End Sub
Code:
Private Sub FilePrint_1()
ActiveDocument.Unprotect Password:="logspec"
spellchecker.BackColor = &HFFFFFF
Me.spellchecker.ForeColor = &HFFFFFF
Me.spellchecker.Height = 1.75
Me.spellchecker.Width = 1.75
Me.spellchecker.BackStyle = 1
ActivePrinter = ""
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _
wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0
Me.spellchecker.BackColor = &HE0E0E0
Me.spellchecker.ForeColor = &H80000012
Me.spellchecker.Height = 21.95
Me.spellchecker.Width = 79.3
Me.spellchecker.BackStyle = 0
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, Noreset:=True, Password:="logspec"
End Sub