Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-01-2015, 06:55 AM
gmaxey gmaxey is offline Creating macro in 2007 to bold within quotes on the fly Windows 7 32bit Creating macro in 2007 to bold within quotes on the fly Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

If I assume that you are starting with existing text like:




This is quote bold test test test unbold end quote.This is quote bold test test test unbold end quote.

The maybe something like this is what you are after"

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Word.Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = "quote bold*unbold end quote"
    .MatchWildcards = True
    While .Execute
      oRng.Words.First.Delete
      oRng.Words.First.Delete
      oRng.Words.Last.Delete
      oRng.Words.Last.Delete
      oRng.Words.Last.Delete
      oRng.Bold = True
      oRng.InsertBefore """"
      oRng.InsertAfter """"
      oRng.Characters.Last.Bold = False
      oRng.Collapse wdCollapseEnd
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
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
Creating macro in 2007 to bold within quotes on the fly How to replace straight quotes with smart quotes in existing document PABwriter Word 4 05-27-2016 03:36 PM
Creating macro in 2007 to bold within quotes on the fly macro to add brackets to each line and add single quotes to each word in the line bracketandquotes Word VBA 17 02-16-2015 03:51 PM
Creating macro in 2007 to bold within quotes on the fly macro to format selected text with curly quotes ysostarman Word VBA 10 11-11-2014 12:51 PM
Macro Needed to bold specific lines and Macro to turn into CSV anewteacher Word VBA 1 05-28-2014 03:59 PM
Creating macro in 2007 to bold within quotes on the fly 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 08:23 AM.


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