Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-30-2022, 03:35 AM
cirerita cirerita is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2021
Novice
Using wildcards to italicize magazine/book titles
 
Join Date: Nov 2022
Posts: 5
cirerita is on a distinguished road
Default Using wildcards to italicize magazine/book titles

Hello,


I have a loooong list of book/magazine titles--well over three or four thousand titles-- and I would need to find a way to italicize those titles.

The listing is something like this:

46. First Magazine 1.8, April 1960
47. Second Magazine 36, April 1960
1144. First Book, September 1981
1145. Second Book, September 1981

I'm a complete beginner re. the use of wildcards. If I use the following wildcard, I'm able to get to the first letter of the book/magazine title, but I don't know how to select the full title, not just the first letter:

[0-9]. [a-zA-Z]

Titles are always preceded by a number, which is followed by a period, and then comes the magazine/book title, always followed by a comma or a number.

The only variable which is unknown here is the length of the title. Is there any wildcard that would allow me to select the full title given there's always a comma or a number after the title?

There's a lot of additional info in each entry, so I can't export this to Excel, where it should be fairly easy to do.

Thanks!!
Reply With Quote
  #2  
Old 11-30-2022, 04:11 AM
Robert2 Robert2 is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2007
Competent Performer
 
Join Date: Jun 2013
Posts: 162
Robert2 will become famous soon enoughRobert2 will become famous soon enough
Default

Try the following wildcard Find/Replace:
Find=[0-9]{1,}.*^13
Replace=^&
with italic format
Reply With Quote
  #3  
Old 11-30-2022, 04:15 AM
macropod's Avatar
macropod macropod is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 really need a macro for this:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[0-9].[ a-zA-Z]@[,0-9]"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
  End With
  Do While .Find.Execute
    i = i + 1
    .Start = .Start + 3
    .End = .End - 1
    .Font.Italic = True
    .Start = .Paragraphs.Last.Range.End
  Loop
End With
Application.ScreenUpdating = True
MsgBox i & " titles formatted."
End Sub
For PC macro installation & usage instructions, see: Installing Macros
For Mac macro installation & usage instructions, see: Word:mac - Install a Macro
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 11-30-2022, 04:17 AM
macropod's Avatar
macropod macropod is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by Robert2 View Post
Try the following wildcard Find/Replace:
Find=[0-9]{1,}.*^13
Replace=^&
with italic format
That formats everything, not just the titles.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 11-30-2022, 07:36 AM
cirerita cirerita is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2021
Novice
Using wildcards to italicize magazine/book titles
 
Join Date: Nov 2022
Posts: 5
cirerita is on a distinguished road
Default

Quote:
Originally Posted by Robert2 View Post
Try the following wildcard Find/Replace:
Find=[0-9]{1,}.*^13
Replace=^&
with italic format
Thanks, but I get the following error message: "The Find What text contains a Pattern Match expression which is not valid"

For some reason, the comma in {1,} does not seem to be valid. If a remove that comma, the Find What text selects the complete line, not only the text.
Reply With Quote
  #6  
Old 11-30-2022, 07:50 AM
macropod's Avatar
macropod macropod is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by cirerita View Post
Thanks, but I get the following error message: "The Find What text contains a Pattern Match expression which is not valid"

For some reason, the comma in {1,} does not seem to be valid. If a remove that comma, the Find What text selects the complete line, not only the text.
That indicates you're using a system with non-English regional settings, for which you would need to replace that ',' with ';'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 11-30-2022, 08:00 AM
cirerita cirerita is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2021
Novice
Using wildcards to italicize magazine/book titles
 
Join Date: Nov 2022
Posts: 5
cirerita is on a distinguished road
Default

Thanks, that did the trick indeed. But as you pointed out, that formats the complete line, not just the titles.

I tried your macro and it seems to work when the title has one word only; if there are two words, then that entry is skipped. Many books/magazines have several words in their titles. Is it possible to italicize all title words?
Reply With Quote
  #8  
Old 11-30-2022, 01:40 PM
macropod's Avatar
macropod macropod is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

Quote:
Originally Posted by cirerita View Post
I tried your macro and it seems to work when the title has one word only; if there are two words, then that entry is skipped. Many books/magazines have several words in their titles. Is it possible to italicize all title words?
On the contrary, the macro turns the examples you posted into:
46. First Magazine 1.8, April 1960
47. Second Magazine 36, April 1960
1144. First Book, September 1981
1145. Second Book, September 1981
Which is consistent with your description in post #1:
Quote:
Originally Posted by cirerita View Post
Titles are always preceded by a number, which is followed by a period, and then comes the magazine/book title, always followed by a comma or a number.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 11-30-2022, 02:20 PM
cirerita cirerita is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2021
Novice
Using wildcards to italicize magazine/book titles
 
Join Date: Nov 2022
Posts: 5
cirerita is on a distinguished road
Default

Thanks! You are, of course, right! Thing is, I tried the macro using some actual titles, and some of them were not properly formatted. Taking a close look at them I noticed there were apostrophes or exclamation points in them. For some reason, the macro skips those titles, as in:

46. First Magazine’s Entry 1.8, April 1960
47. Second Magazine 36, April 1960
1144. First Book, September 1981
1145. Second Book, September 1981

Is there a way for the macro to ignore apostrophes, exclamation points, and so on, so that all titles get italics?

There are also some 300 titles that are not followed by a comma or a number, as in:

74. Mindscapes: Poems for the Real World
Richard Peck, ed. | Dell Publishing Company: New York, NY | 1972

After running the macro I get this:
74. Mindscapes: Poems for the Real World
Richard Peck
, ed. | Dell Publishing Company: New York, NY | 1972


The title line is followed by the editor's name in the next line. Both lines are separated by a paragraph break. Could this be used in the macro somehow so that when there's no comma and no number after the title--but there's a paragraph break--then the italics are not used after the title?
Reply With Quote
  #10  
Old 11-30-2022, 03:11 PM
macropod's Avatar
macropod macropod is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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 could replace:
[ a-zA-Z]@[,0-9]
with:
[0-9].[!,0-9]@[,0-9^t^l^13]
With this expression, the formatting will stop before a comma, number, tab, manual line break or paragraph break - whichever comes first.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 12-01-2022, 03:38 AM
cirerita cirerita is offline Using wildcards to italicize magazine/book titles Windows 10 Using wildcards to italicize magazine/book titles Office 2021
Novice
Using wildcards to italicize magazine/book titles
 
Join Date: Nov 2022
Posts: 5
cirerita is on a distinguished road
Default

That did work, thanks a lot!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
A macro to find interjections from a list and italicize them FabioDD Word VBA 8 03-15-2022 06:28 AM
Using wildcards to italicize magazine/book titles Magazine-like templates in Word 2019? dylansmith Word 2 05-11-2020 03:58 PM
How can I change the order of book pages of an existing book to left-to-right instead of right to le Iris12 Publisher 0 02-06-2018 09:37 AM
Digital Magazine Publications! epublisherWorld1 Publisher 0 08-28-2017 03:49 AM
Using wildcards to italicize magazine/book titles magazine column style Nasser Word 4 04-21-2010 02:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:36 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