Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-20-2014, 10:17 AM
ljd108 ljd108 is offline Macro to  change specific text styles Windows Vista Macro to  change specific text styles Office 2010 32bit
Novice
Macro to  change specific text styles
 
Join Date: Oct 2014
Posts: 24
ljd108 is on a distinguished road
Default Macro to change specific text styles

Hi,



I would like to create a macro that changes a word into a particular custom style (called 'glossary pop up) the first time it appears under another specific custom style set (called 'page title'). There are a number of 'Page titles' throughout the document and so each new page title I would like the text to change the first time it appears.

Is this possible?

Thanks
Reply With Quote
  #2  
Old 10-20-2014, 12:33 PM
macropod's Avatar
macropod macropod is offline Macro to  change specific text styles Windows 7 64bit Macro to  change specific text styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

You don't need a macro for that - it can be done using just Find/Replace. If you want, though, you could use the macro recorder to record the Find/Replace process as a macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 10-22-2014, 02:18 PM
ljd108 ljd108 is offline Macro to  change specific text styles Windows Vista Macro to  change specific text styles Office 2010 32bit
Novice
Macro to  change specific text styles
 
Join Date: Oct 2014
Posts: 24
ljd108 is on a distinguished road
Default Macro options

Hi,

Thanks for your response and apologies for the delay. The reason I wanted the macro is because the word(s) appear multiple times throughout the document and I want them to be a different style the first time they appear under a specific style but not all the times they appear.

I am already doing this using find and replace but it takes a while to see if it is the first time it appears under a specific style.

I am now thinking that it may be easier to continue to use find and replace for the process itself and then use a macro as a control to check that the text has only been selected once under a particular style.

Are you aware if there is a macro I could run to find all instances of a particular style (the styles will be character text rather than paragraph text) under another particular style (which will be a paragraph style) throughout a document?

Thanks
Reply With Quote
  #4  
Old 10-22-2014, 03:19 PM
macropod's Avatar
macropod macropod is offline Macro to  change specific text styles Windows 7 64bit Macro to  change specific text styles Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

With the Find/Replace, you specify the Style to find as one of the Find parameters and the replacement Style as another parameter and only do the Replace once. The only time this might be an issue is if you do the Find/Replace, then update the document so that another instance of the word becomes the first instance. You could, of course, record the Find/Replace as a macro but that would only work for that particular word and I gather you have more than one word to find. A Find/Replace macro that processes multiple words could also be written but, unless, you're always working with the same set of words, you then have to consider how the list will be maintained.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Needed to bold specific lines and Macro to turn into CSV anewteacher Word VBA 1 05-28-2014 03:59 PM
Macro to  change specific text styles Quickest way to change text to Arial size 11 specific colour BlueClearSky Word 6 11-22-2013 03:34 PM
Macro to  change specific text styles Why do imported styles not change to default font? OldGrantonian Word 4 05-18-2011 06:35 AM
Macro to  change specific text styles Need help extracting specific text from one doument to another with macro/VBA. zsmithku Word 1 04-15-2011 03:46 PM
Why can't I change certain styles back to normal? SuperHans Word 1 10-16-2009 03:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:17 PM.


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