Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-10-2024, 07:12 AM
Shelley Lou Shelley Lou is offline VBA format plain quotes to bold quotes Windows 10 VBA format plain quotes to bold quotes Office 2016
Competent Performer
VBA format plain quotes to bold quotes
 
Join Date: Dec 2020
Posts: 170
Shelley Lou is on a distinguished road
Default VBA format plain quotes to bold quotes

I am trying to put together a macro that formats all plain double quotes if they are either side of bold text within a word document. I know how to do a find of ("(*)") if all the text is plain but I can't seem to work out how to find a plain quote with bold text. Can anyone help at all. Thanks



Find Plain Quotes.docx

Capture.JPG
Reply With Quote
  #2  
Old 02-10-2024, 11:35 AM
gmaxey gmaxey is offline VBA format plain quotes to bold quotes Windows 10 VBA format plain quotes to bold quotes Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = Chr(34)
    .Font.Bold = False
    While .Execute
      oRng.Select
      On Error Resume Next
      If oRng.Characters.Last.Next.Font.Bold = True Then oRng.Font.Bold = True
      If oRng.Characters.Last.Previous.Font.Bold = True Then oRng.Font.Bold = True
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 02-11-2024, 04:09 AM
Shelley Lou Shelley Lou is offline VBA format plain quotes to bold quotes Windows 10 VBA format plain quotes to bold quotes Office 2016
Competent Performer
VBA format plain quotes to bold quotes
 
Join Date: Dec 2020
Posts: 170
Shelley Lou is on a distinguished road
Default VBA format plain quotes to bold quotes

Thank you so much Greg for taking the time to provide this code, works perfectly, much appreciated
Reply With Quote
  #4  
Old 02-11-2024, 05:56 AM
gmaxey gmaxey is offline VBA format plain quotes to bold quotes Windows 10 VBA format plain quotes to bold quotes Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

You are welcome. Glad I could help.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem when changing single-quotes to double-quotes Lup Word 14 02-14-2020 02:46 AM
VBA format plain quotes to bold quotes How to replace straight quotes with smart quotes in existing document PABwriter Word 4 05-27-2016 03:36 PM
Changing dumb quotes to smart quotes Reisende Word 2 05-02-2016 08:56 PM
Creating macro in 2007 to bold within quotes on the fly marymaryt Word VBA 5 06-01-2015 06:55 AM
VBA format plain quotes to bold quotes Changing single-quotes to double-quotes Bobosmite Word 5 04-15-2013 06:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:10 AM.


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