Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-23-2023, 03:38 AM
RobiNew RobiNew is offline VBA Quotes Before Punctuation Windows 10 VBA Quotes Before Punctuation Office 2016
Competent Performer
VBA Quotes Before Punctuation
 
Join Date: Sep 2023
Posts: 200
RobiNew is on a distinguished road
Question VBA Quotes Before Punctuation

I am trying to move quotes before punctuation with a Word macro, but apart from an error in the code here below, I cannot find a way to swap characters without using 'Selection.' Can someone help? Thanks! Here's the code:


Quote:
'VBA Quotes Before Punctuation


Application.ScreenUpdating = False
Dim myRng As Word.Range, myChr
For Each myRng In ActiveDocument.StoryRanges 'Text and Footnotes
Do
For Each myChr In myRng.Characters
If myChr.Text Like "[,;.:?]" _
And myChr.First.Next.Text Like "[«‹›»" & Chr(39) & Chr(34) & Chr(146) & Chr(148) & "]" Then
'Revert without using "Selection."
End If
Next
Set myRange = myRange.NextStoryRange
Loop Until myRange Is Nothing
Next

Last edited by RobiNew; 09-23-2023 at 07:24 AM. Reason: typo
Reply With Quote
 

Tags
characters, quotes, swap



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
Curly Smart Quotes Switch to Straight Smart Quotes in New Chapters TheWriterBloke Word 3 03-29-2019 03:11 AM
VBA Quotes Before Punctuation 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
VBA Quotes Before Punctuation 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 07:41 PM.


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