Automating Format Painter using VBA (1 Viewer)

aziz rasul

Active member
Local time
Today, 12:41
Joined
Jun 26, 2000
Messages
1,779
I have a document where I have dates written like so: -

7th of August
13th of February
3rd of July
1st of May

and so on.

The 'th', 'rd' and 'st' parts are not superscript and I want to make them so. How do I create a macro or create a function using VBA that sweeps thru the document and sense wherever there is a number followed by a 'th', 'rd' or 'st' and make the 'th', 'rd' and 'st' superscript?
 

Rod D

Registered User.
Local time
Today, 04:41
Joined
Feb 9, 2006
Messages
87
Do You really want to use VBA?

You don't really need VBA to do this.

To update the text in the document, Click on Format (from main menu bar), then AutoFormat...

A dialog opens that allows you to update the entire document.
Click on the Options Button to open the formatting dalog box and ensure that the Ordinals (1st) with Superscript is checked, then Click the OK button to close the dialog box.

You can then update your document by clicking the OK button.

I have attached some screen shots, just in case.

Hope this Helps
Rgds
Rod
 

Attachments

  • ScreenShots.zip
    62.5 KB · Views: 250

aziz rasul

Active member
Local time
Today, 12:41
Joined
Jun 26, 2000
Messages
1,779
I tried that, but it deletes the empty lines between the paragraphs as well as solving the problem that I had.

Even when I ONLY have a check mark against the Ordinals ...
 

Rod D

Registered User.
Local time
Today, 04:41
Joined
Feb 9, 2006
Messages
87
Took me a while to replicate your problem - looks like it is linked to having differing paragraph formats. Just have to figure out how to switch that bit off now!
 

Users who are viewing this thread

Top Bottom