![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
I'm completely new to macros in MS Word, but not entirely new to programming.
I'm looking to select all of the words in my document that begin with a "7" and end with a "pm". They have varying stuff in between such as "7:47pm" and so on. How would I go about making such a macro in VBA? Once selected, I would like to change the font size down to 7. I would imagine this would be super simple macro for those experienced, but I really have no idea where to start. Any suggestions are appreciated. Thanks! |
#2
|
||||
|
||||
![]()
Hi gcom,
If you're wanting to change the whole string to 7pt, use a wildcard Find/Replace, where: Find = 7:[0-9]{2}pm Replace = ^& and the replacement font option is set to 7pt.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Thank you so much for helping me with that!
So, how exactly does that work? I understand the "7:" and "pm" obviously, but what is with the "[0-9] and the "{2}"? The "^&" just replaces with the same content in the find box, right? Thanks! |
#4
|
||||
|
||||
![]() Quote:
You're right about the ^&. Check out Word's Help file for more details on using wildcards.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
macropod
What is the function of ^? while using it in find dialog (I mean CTRL+F)? |
#6
|
||||
|
||||
![]()
The '^?' combination means 'any character' but is not valid for a wildcard Find. For other control characters you can use in the Find/Replace expression, see: https://support.office.microsoft.com...rs=en-US&ad=US
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
garlapati | Word | 5 | 04-04-2011 02:05 PM |
![]() |
simpleonline1234 | Word VBA | 1 | 02-25-2011 02:28 AM |
Objective: Automatically export email text,attachment text to DB friendly format | SilentLee | Outlook | 0 | 11-14-2010 02:45 PM |
Selected text and logo in one macro | marijke | Word VBA | 0 | 08-24-2009 07:01 AM |
Select text between characters | davers | Word | 10 | 05-24-2009 05:15 AM |