![]() |
|
|
|
#1
|
||||
|
||||
|
You can probably achieve what you're after with:
Code:
Sub FilePrint()
Application.ScreenUpdating = False
Dim i As Long, Rng As Range
With ActiveDocument
.ActiveWindow.View.ShowFieldCodes = False
For i = .Fields.Count To 1 Step -1
With .Fields(i)
If .Type = wdFieldMacroButton Then
.Code.Font.Hidden = True
.Update
End If
End With
Next
Application.Dialogs(wdDialogFilePrint).Show
For i = .Fields.Count To 1 Step -1
With .Fields(i)
If .Code.Font.Hidden = True Then
.Code.Font.Hidden = False
.Update
End If
If .Type = wdFieldMacroButton Then .DoClick: .DoClick
End With
Next
End With
Application.ScreenUpdating = True
End Sub
Code:
Sub PS_Requirements()
ActiveWindow.View.ShowHiddenText = False
Dim i As Long, ArrBkMk
ArrBkMk = Array("PS_All_Metadata", "PS_1_ReqtTextOnly", "PS_1_Sec_Button", _
"PS_1_Button", "PS_2_ReqtTextOnly", "PS_2_Sec_Button", "PS_2_Button", _
"PS_3_ReqtTextOnly", "PS_3_Sec_Button", "PS_3_Button", "PS_4_ReqtTextOnly", _
"PS_4_Sec_Button", "PS_4_Button", "PS_5_ReqtTextOnly", "PS_5_Sec_Button", _
"PS_5_Button", "PS_6_ReqtTextOnly", "PS_6_Sec_Button", "PS_6_Button", _
"PS_7_ReqtTextOnly", "PS_7_Sec_Button", "PS_7_Button", "PS_8_ReqtTextOnly", _
"PS_8_Sec_Button", "PS_8_Button", "PS_9_ReqtTextOnly", "PS_9_Sec_Button", _
"PS_9_Button", "PS_10_ReqtTextOnly", "PS_10_Sec_Button", "PS_10_Button", _
"PS_11_ReqtTextOnly", "PS_11_Sec_Button", "PS_11_Button", _
"PS_12_ReqtTextOnly", "PS_12_Sec_Button", "PS_12_Button")
With Selection.Fields(1).Code
If InStr(.Text, "Collapse") > 0 Then
.Text = Replace(.Text, "Collapse", "Expand")
With ActiveDocument
For i = 0 To UBound(ArrBkMk)
.Bookmarks(ArrBkMk(i)).Range.Font.Hidden = True
Next
End With
Else
.Text = Replace(.Text, "Expand", "Collapse")
With ActiveDocument
For i = 0 To UBound(ArrBkMk)
.Bookmarks(ArrBkMk(i)).Range.Font.Hidden = False
Next
End With
End If
End With
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Moving Quick Parts with the document | derohanes | Word | 4 | 10-23-2013 09:30 PM |
Print only certain parts of a document on demand
|
jirkap | Word VBA | 1 | 09-29-2013 08:56 PM |
Creating new document from parts of another document
|
matthewgeary | Word VBA | 1 | 10-05-2012 10:09 AM |
| hiding images in word document | gib65 | Drawing and Graphics | 3 | 08-17-2011 11:09 AM |
| hiding selected objects in word document | gib65 | Word | 0 | 08-09-2011 12:00 PM |