Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 02-15-2015, 10:16 PM
macropod's Avatar
macropod macropod is offline macro to add brackets to each line and add single quotes to each word in the line Windows 7 64bit macro to add brackets to each line and add single quotes to each word in the line Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,369
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

Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim bOpt1 As Boolean, bOpt2 As Boolean
With Options
  bOpt1 = .AutoFormatAsYouTypeReplaceQuotes
  bOpt2 = .AutoFormatReplaceQuotes
  .AutoFormatAsYouTypeReplaceQuotes = False
  .AutoFormatReplaceQuotes = False
End With
With ActiveDocument
  With .Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Format = False
    .Forward = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Wrap = wdFindContinue
    .Text = " "
    .Replacement.Text = "', '"
    .Execute Replace:=wdReplaceAll
    .Text = "^13"
    .Replacement.Text = "'),^p('"
    .Execute Replace:=wdReplaceAll
  End With
  .Range.Paragraphs.Last.Range.Cut
  .Range(0, 0).Paste
  .Range.Paragraphs.First.Range.Characters.Last.Delete
End With
With Options
  .AutoFormatAsYouTypeReplaceQuotes = bOpt1
  .AutoFormatReplaceQuotes = bOpt2
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to add brackets to each line and add single quotes to each word in the line How many points is line spacing 'single'? Ugeen Word 2 11-24-2013 03:14 PM
macro to add brackets to each line and add single quotes to each word in the line Changing single-quotes to double-quotes Bobosmite Word 5 04-15-2013 06:40 AM
From the command line, how do I run a Word macro? jdockstader Word 7 02-04-2013 06:09 AM
Single Line Spacing for Short Lists? tatihulot Word 2 04-20-2010 02:53 PM
macro to add brackets to each line and add single quotes to each word in the line Different alignments in a single line George99 Word 2 01-24-2010 05:49 PM

Other Forums: Access Forums

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