View Single Post
 
Old 03-21-2014, 09:03 AM
glowackt glowackt is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Mar 2014
Posts: 3
glowackt is on a distinguished road
Default

Thank you for your suggestion. I guess this application is a little more complicated when I implement the code. I am attaching a pdf that show the code works for the printout. I would like to send you two docm files, the first would be the document I printed, and the second would be the document after the screen updates were made. Since I can't upload these files here, how can I send them to you? I have created them as trusted douments, with the macros they use contained in them.

My users will have the option to collapse any portion or portions of the document as they are editing it. The samples I would like to send you shows what the document looks like before I print it, and the second file is the results with the screen updates from printing after I selected to collape all the "metadata" entries within the document.

New thought: Would it be possible to create a temp copy of the document for printing? Once the doc is printed, this temp could be deleted, leaving the original document in tack. This is what is happening: I have selected to hide mulitple sections of the document which contain macrobuttons. When the file gets updated via the screen update, any macrobutton that was hidden at prnt time is coming back with the macrobutton expanded code (MACROBUTTON PS_1_1_1_Metadata Collapse). I cannot toggle it back to the "button". Any macrobutton that was not hidden before the PrintPreviewAndPrint macro is executed, is replaced correctly via the screen update (Collapse-Section_1).

This is the code that is setup for each "section/subsection" of my document:
Code:
Sub PS_1_1_Metadata()
ActiveWindow.View.ShowHiddenText = False
With Selection.Fields(1).Code
  If InStr(.Text, "Collapse") > 0 Then
    .Text = Replace(.Text, "Collapse", "Expand")
    ActiveDocument.Bookmarks("PS_1_1_Metadata").Range.Font.Hidden = True
  Else
    .Text = Replace(.Text, "Expand", "Collapse")
    ActiveDocument.Bookmarks("PS_1_1_Metadata").Range.Font.Hidden = False
  End If
End With
End Sub


Each macrobutton has a corresponding bookmark which indicates which text is being displayed or hidden. The doc looks similar to the following:

bookmark Section_1_Button macrobutton: Collapse-Section_1 End of bookmark
1. Section 1 paragraph

Bookmark: PS_Section_1_Subsections
bookmark: PS_1_Button macrobutton: Collapse End of bookmark
bookmark: PS_1_Metadata Metadata 1
Table appears here
End of bookmark

1.1 Section 1 paragraph

bookmark: PS_1_1_Button macrobutton: Collapse End of bookmark
bookmark: PS_1_1_Metadata Metadata 1.1
Table appears here
End of bookmark PS_1_1_Metadata
End of bookmark PS_Section_1_subsections

The macrobuttons and bookmarks nest throughout the document.
I can select to hide (or restore) via macrobutton Collapse or Expand options:
· Everything except the first level Section paragraphs
· The Metadata throughout the entire document
· An individual section
· Each individual metadata sections
This setup allows the users to save the document in any state of collapsed or expanded sections. Two items are still needed to make this efficient:
A macro that would “read” the “saved options” for the macrobuttons, and execute that option when the document is opened.
A way to “reset” all the macrobuttons to Collapse as an option. I don’t want to do the reset automatically when the doc opens, because the user may want the document to open with the options specified as they saved it.

Last edited by macropod; 03-21-2014 at 02:06 PM. Reason: Added code tags & formatting
Reply With Quote