Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #18  
Old 08-19-2012, 10:37 PM
ubns ubns is offline Macro to replace one specific heading style with another Windows 7 32bit Macro to replace one specific heading style with another Office 2010 32bit
Competent Performer
Macro to replace one specific heading style with another
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Hi Paul,

For some reason this code has stopped working now? any idea why? There is no message but it does not import the custom heading styles from the normal.dotm in the currently opened document. this code was worknig feww days ago.

I do not know what has happened now.

I have attched the code for your reference


Code:
Sub Document_Open()
With ActiveDocument.Content.find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Text = "monitor"
  .Replacement.Text = "review"
  .Forward = True
  .Wrap = wdFindContinue
  .Format = False
  .MatchCase = False
  .MatchWholeWord = True
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  .Execute Replace:=wdReplaceAll
End With
With ActiveDocument.Content.find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Text = "folder or on a seperate disc"
  .Replacement.Text = "folder"
  .Forward = True
  .Wrap = wdFindContinue
  .Format = False
  .MatchCase = False
  .MatchWholeWord = True
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  .Execute Replace:=wdReplaceAll
End With
With ActiveDocument
  If InStr(.Sections.First.Footers(wdHeaderFooterFirstPage).Range.Text, "Statement of Advice") > 0 Then
   Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
   Name:="Custom Breakout", Object:=wdOrganizerObjectStyles
   Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
   Name:="Custom Breakout Subheading", Object:=wdOrganizerObjectStyles
   Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
   Name:="Custom Page Heading", Object:=wdOrganizerObjectStyles
   Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
   Name:="Custom Page Subheading 1.0", Object:=wdOrganizerObjectStyles
   Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
   Name:="Custom Paragraph Main Heading 1.0", Object:=wdOrganizerObjectStyles
   Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
   Name:="Umesh Table Style", Object:=wdOrganizerObjectStyles
 End If
End With
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to replace one specific heading style with another Create and save custom heading style ubns Word 3 08-01-2012 09:42 PM
Macro to replace one specific heading style with another Modify a numbered heading style TheQueenBea Word 3 06-05-2012 12:12 PM
Macro to replace one specific heading style with another Changing numbering in a Heading style TheQueenBea Word 1 05-31-2012 02:22 PM
Macro to replace one specific heading style with another Very frequent heading style, but still not built in Word!!!!! why??? Jamal NUMAN Word 17 06-30-2011 05:47 PM
How to have this Heading – Table of contents style? Jamal NUMAN Word 0 01-13-2011 06:02 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft