View Single Post
 
Old 08-23-2012, 05:36 PM
ubns ubns is offline Windows 7 32bit Office 2010 32bit
Competent Performer
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default Another issue

Hi Paul,

Sorry to ask this again, I am just trying to make it work.

Now it is giving the error "Style not found". I thought something should be wrong with the style name, however when I clicked on the Debug, the error was on some other line. See the attached image and code is below
Code:
Sub Document_Open()
Dim StrSty As String, i As Long
StrSty = "Custom Breakout,Custom Breakout Subheading,Custom Page Heading," & _
  "Custom Page Subheading 1.0,Table Grid, Umesh Table"
With ActiveDocument
  With .Content.find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Text = "monitor"
    .Replacement.Text = "review"
    .Execute Replace:=wdReplaceAll
    .Text = "folder or on a seperate disc"
    .Replacement.Text = "folder"
    .Execute Replace:=wdReplaceAll
  End With
  If InStr(.Sections.First.Footers(wdHeaderFooterFirstPage).Range.Text, "Statement of Advice") > 0 Then
    For i = 0 To UBound(Split(StrSty, ","))
      Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
        Name:=Split(StrSty, ",")(i), Object:=wdOrganizerObjectStyles
    Next
  End If
End With
End Sub
Attached Images
File Type: png Macro Issue.PNG (38.0 KB, 14 views)
Reply With Quote