View Single Post
 
Old 03-24-2014, 03:26 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
Note: Instead of those many lines of 'ActiveDocument.Bookmarks(name).Range.Font.Hidden =' in your 'PS_Requirements' and 'PS_All_Metadata' subs you could simplify the code with arrays and loops like:
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]
Reply With Quote