Results 1 to 11 of 11
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does anyone know of a way to print the styles (style width pane) along the left hand side of a printed page so users can see what styles have been used when looking at a printed copy?

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    Renton, Washington, USA
    Posts
    12,560
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Not possible, but you can take a series of screen shots and print them.

    Now running HP Pavilion a6528p, with Win7 64 Bit OS.

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    [quote name='Sherri S' post='785464' date='20-Jul-2009 19:25']Does anyone know of a way to print the styles (style width pane) along the left hand side of a printed page so users can see what styles have been used when looking at a printed copy?[/quote]
    You could create a Macro that adds the stylename to a comment, or to a text box, next to each paragraph. Something like...
    Code:
    Public Sub ShowStyles()
    	 Dim para As Paragraph
    	 
    	 With ActiveDocument
    		 For Each para In .Paragraphs
    			 .Comments.Add Range:=para.Range, Text:=para.Style.NameLocal
    		 Next para
    	 End With ' Activedocument
     
     End Sub

  4. #4
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    [quote name='StuartR' post='785514' date='21-Jul-2009 18:56']You could create a Macro that adds the stylename to a comment, or to a text box, next to each paragraph. Something like...
    Code:
    Public Sub ShowStyles()
    	 Dim para As Paragraph
    	 
    	 With ActiveDocument
    		 For Each para In .Paragraphs
    			 .Comments.Add Range:=para.Range, Text:=para.Style.NameLocal
    		 Next para
    	 End With ' Activedocument
     
     End Sub
    [/quote]
    Stuart hi
    I thought this would be quite useful, particularly as several of our staff insist on converting old WP docs for their use, but when I ran the macro it failed at the ".Comments.Add Range.." statement. (Running XPP SP3, MSO 2003).
    cheers

    Phil Carter

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    What error message do you get? The macro works OK for me (although it's only useful if you display comments in balloons).

  6. #6
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='785802' date='23-Jul-2009 07:12']What error message do you get? The macro works OK for me (although it's only useful if you display comments in balloons).[/quote]
    Hans thanks for that

    The macro displayed the error, "Run time error 4605, This method is not available because the object refers to the end of a table row.", and appeared to stop at the second row of a table, but when I clicked debug it highlighted that code.

    On subsequent running it appears to work fine
    cheers

    Phil Carter

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    After the Macro fails do you see any comments in the Document?

    I just tried running this Macro on a fairly complex document and it did fail when it got to the end of a table row, if this is your problem then it should be fairly easy to fix by adding
    On Error Resume Next
    before
    With ActiveDocument

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Ah, I hadn't tested in a document with tables.

    To emulate the behavior of Word's style display slightly better, you can exclude tables:

    Code:
    Public Sub ShowStyles()
      Dim para As Paragraph
      With ActiveDocument
    	For Each para In .Paragraphs
    	  If Not para.Range.Information(wdWithInTable) Then
    		.Comments.Add Range:=para.Range, Text:=para.Style.NameLocal
    	  End If
    	Next para
      End With ' Activedocument
    End Sub

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Stuart, your fix will still add comments to table cells, which leads to a rather busy display. But it might be useful.

    Word's built-in style area feature completely skips tables; my previous reply shows how to do that in your macro.

    It's up to the user to decide which version works best for their purposes.

  10. #10
    4 Star Lounger
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    543
    Thanks
    56
    Thanked 0 Times in 0 Posts
    [quote name='StuartR' post='785812' date='23-Jul-2009 07:32']After the Macro fails do you see any comments in the Document?

    I just tried running this Macro on a fairly complex document and it did fail when it got to the end of a table row, if this is your problem then it should be fairly easy to fix by adding
    On Error Resume Next
    before
    With ActiveDocument[/quote]
    Stuart hi

    That worked fine

    Thanks a lot
    cheers

    Phil Carter

  11. #11
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    If you are going to be using this Macro extensively then there are a number of improvements that could be made.
    • Delete any existing comments where the text is the style name before adding new comments
      • Could provide a separate Macro for this, so that you can add and remove the style comments at will
    • Create comments where the range is just an insertion point, rather than the whole paragraph, so that document text is not all highlighted
    Each of these would require some effort so would not be worth doing if you will only use this occasionally.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •