Timotheus142
02-21-2017, 07:14 PM
Hey guys,
I´m currently having a small problem: I´m working on a really big document with hundreds of bookmarks and input fields to enter + hide and show different elements. I´m simply hiding/showing by
ActiveDocument.Bookmarks("X10").Range.Font.Hidden = Not CheckBox2a.Value
The problem I have is: If I print the document (Doesnt matter if by vba -see below- or word itself), the hidden rich text elements (that are bookmarks aswell to allow only certain inputs) get shown again and remain in the document. I just can´t move em out, even if I execute the actualization in the same step as the printing (actualization works fine and all not-used fields are removed.). Document looks fine excpet after printing...
Unspectacular printing VBA without the actualization calls (which are all similar to the method shown above):
Private Sub CommandButton11_Click()
If ActiveDocument.Bookmarks("Ma3").Empty = True Then
ActiveDocument.Bookmarks("Ma3B").Range.Font.Hidden = True
End If
If ActiveDocument.Bookmarks("Ma3").Range = " " Then
ActiveDocument.Bookmarks("Ma3B").Range.Font.Hidden = True
End If
If ActiveDocument.Bookmarks("Ma3").Range <> " " Then
ActiveDocument.Bookmarks("Ma3B").Range.Font.Hidden = False
End If
Application.PrintOut FileName:="", Copies:=1, Range:=wdPrintRangeOfPages, Pages:="p1s2-p15s10"
End Sub
I´m still kinda new to VBA and so far I couldn´t find a working method to change the printing process so much that it does not show the hidden elements again. Maybe any idea? Help appreciated!
Small visual example of what´s going on: (2/3/4 etc. should be hidden and are hidden until I click print or save as PDF)
18439
All the best!
I´m currently having a small problem: I´m working on a really big document with hundreds of bookmarks and input fields to enter + hide and show different elements. I´m simply hiding/showing by
ActiveDocument.Bookmarks("X10").Range.Font.Hidden = Not CheckBox2a.Value
The problem I have is: If I print the document (Doesnt matter if by vba -see below- or word itself), the hidden rich text elements (that are bookmarks aswell to allow only certain inputs) get shown again and remain in the document. I just can´t move em out, even if I execute the actualization in the same step as the printing (actualization works fine and all not-used fields are removed.). Document looks fine excpet after printing...
Unspectacular printing VBA without the actualization calls (which are all similar to the method shown above):
Private Sub CommandButton11_Click()
If ActiveDocument.Bookmarks("Ma3").Empty = True Then
ActiveDocument.Bookmarks("Ma3B").Range.Font.Hidden = True
End If
If ActiveDocument.Bookmarks("Ma3").Range = " " Then
ActiveDocument.Bookmarks("Ma3B").Range.Font.Hidden = True
End If
If ActiveDocument.Bookmarks("Ma3").Range <> " " Then
ActiveDocument.Bookmarks("Ma3B").Range.Font.Hidden = False
End If
Application.PrintOut FileName:="", Copies:=1, Range:=wdPrintRangeOfPages, Pages:="p1s2-p15s10"
End Sub
I´m still kinda new to VBA and so far I couldn´t find a working method to change the printing process so much that it does not show the hidden elements again. Maybe any idea? Help appreciated!
Small visual example of what´s going on: (2/3/4 etc. should be hidden and are hidden until I click print or save as PDF)
18439
All the best!