I have a requirement to 'import' document based on x template into a y template. The import (VBA code) works fine where copying is involved etc. It also has to reset the Heading styles to match the new template, change the case, etc. BTW: I have switched off track changes.
For this I use the code below. Only problem is that some of these documents are absolutely huge (1500 pages +) and I keep getting this message: The code is:
Code: Select all
Function SetCaps(style2Check As Variant)
'
' SetCaps Function
'
Selection.SetRange Start:=ActiveDocument.Sections(4).Range.Start, _
End:=ActiveDocument.Sections(4).Range.End
Do
With Selection.Find
.ClearFormatting
.Text = ""
.Forward = True
.Format = True
.Wrap = wdFindStop
.Style = style2Check
If .Execute Then
Selection.Range.Style = style2Check
Selection.Range.Case = wdLowerCase
Selection.Range.Case = wdTitleSentence
Else
Exit Function
End If
End With
Loop
End Function
Thanks.