Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 08-12-2012, 05:45 PM
macropod's Avatar
macropod macropod is offline Macro to replace one specific heading style with another Windows 7 64bit Macro to replace one specific heading style with another Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Why are you trying to access Normal.dot through code? That makes no sense at all for what you said you want to do:
Quote:
change a specific heading style in my document to another heading style
All you need for that is to use Find/Replace to replace one Style with the other.

Given that we're dealing with heading styles, you would only access Normal.dot to:
• modify an existing Style, so that the change applies to all documents. But, since that would only be done once, you wouldn't use code; or
• to ensure a current Style definition gets carried over to the document being opened. In that case, you might use code like:
Code:
Private Sub Document_Open()
With ActiveDocument
  Application.OrganizerCopy Source:=.AttachedTemplate.FullName, Destination:=.FullName, _
    Name:=.Styles(wdStyleHeading2).NameLocal, Object:=wdOrganizerObjectStyles
End With
End Sub
Which you would put into the Document's 'This Document' module. If you were to put it into the Template's 'This Document' module, it could adversely affect documents that shouldn't be changed.

Depending on what you're trying to achieve, though, all you might need to do is to check the 'automatically update document styles' option.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
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 12:03 PM.


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