View Single Post
 
Old 09-16-2014, 07:29 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Do you mean you want to add the following?

Code:
With wdDoc
    'Process the body
    Call Update(.Range)
    'Process textboxes etc in the body
    For Each Shp In .Shapes
        With Shp.TextFrame
            If .HasText Then
                Call Update(.TextRange)
            End If
        End With
    Next
    For Each Sctn In .Sections
        For Each HdFt In Sctn.Headers
            With HdFt
                If .LinkToPrevious = False Then
                    'Process the header
                    Call Update(.Range)
                End If
            End With
        Next
    Next
    .Close SaveChanges:=True
End With
In that case bear in mind that the document used by the code I posted is oDoc rather than wdDoc and you must no close that document from the code as the add-in takes care of that, so it is simply a matter of inserting the relevant bits of the code into the original macro

So you need to add this bit after the line
Next oFF
Don't forget to include The Update code and to declare the additional variables used here at the top of the function. I haven't tested you additional code.

Code:
With oDoc
    'Process the body
    Call Update(.Range)
    'Process textboxes etc in the body
    For Each Shp In .Shapes
        With Shp.TextFrame
            If .HasText Then
                Call Update(.TextRange)
            End If
        End With
    Next
    For Each Sctn In .Sections
        For Each HdFt In Sctn.Headers
            With HdFt
                If .LinkToPrevious = False Then
                    'Process the header
                    Call Update(.Range)
                End If
            End With
        Next
    Next
End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote