Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 03-24-2014, 03:26 PM
macropod's Avatar
macropod macropod is offline Conditionally hiding parts of a document Windows 7 32bit Conditionally hiding parts of a document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,523
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving Quick Parts with the document derohanes Word 4 10-23-2013 09:30 PM
Conditionally hiding parts of a document Print only certain parts of a document on demand jirkap Word VBA 1 09-29-2013 08:56 PM
Conditionally hiding parts of a document 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

Other Forums: Access Forums

All times are GMT -7. The time now is 09:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft