Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-09-2023, 01:07 AM
RobiNew RobiNew is offline Word macro to find any character (^?) without using Selection Windows 10 Word macro to find any character (^?) without using Selection Office 2016
Competent Performer
Word macro to find any character (^?) without using Selection
 
Join Date: Sep 2023
Posts: 183
RobiNew is on a distinguished road
Default Word macro to find any character (^?) without using Selection

I need a word macro to find any character without using Selection. In other words I need the equivalent of '^?'. Thanks!
Reply With Quote
  #2  
Old 10-09-2023, 03:27 AM
Italophile Italophile is offline Word macro to find any character (^?) without using Selection Windows 11 Word macro to find any character (^?) without using Selection Office 2021
Expert
 
Join Date: Mar 2022
Posts: 338
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Several of the questions you have asked here already contain code that finds things without using Selection. I'm sure that, if you invest a few short minutes of your time, you could modify the code you already have to meet your new requirement. It isn't difficult to do.
Reply With Quote
  #3  
Old 10-09-2023, 03:32 AM
RobiNew RobiNew is offline Word macro to find any character (^?) without using Selection Windows 10 Word macro to find any character (^?) without using Selection Office 2016
Competent Performer
Word macro to find any character (^?) without using Selection
 
Join Date: Sep 2023
Posts: 183
RobiNew is on a distinguished road
Default

Thank you, but I don't want to find just 'things'. I need the equivalent of '^?'.
Reply With Quote
  #4  
Old 10-09-2023, 03:40 AM
Italophile Italophile is offline Word macro to find any character (^?) without using Selection Windows 11 Word macro to find any character (^?) without using Selection Office 2021
Expert
 
Join Date: Mar 2022
Posts: 338
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

Quote:
Originally Posted by RobiNew View Post
Thank you, but I don't want to find just 'things'. I need the equivalent of '^?'.
And you can modify code that you already have to do that. It isn't difficult to do.
Reply With Quote
  #5  
Old 10-10-2023, 11:34 PM
RobiNew RobiNew is offline Word macro to find any character (^?) without using Selection Windows 10 Word macro to find any character (^?) without using Selection Office 2016
Competent Performer
Word macro to find any character (^?) without using Selection
 
Join Date: Sep 2023
Posts: 183
RobiNew is on a distinguished road
Question

I have the following macro to find any character before minus. Is it possible to use the equivalent of '^?' instead of the long string in .Text? Can someone help? Thanks!



Code:
Sub CharPlusMinus()
'Find ANY character before -
Dim xRng As Range, iType As Integer
For iType = 1 To 2
Set xRng = ActiveDocument.StoryRanges(iType)
  With xRng.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchWildcards = False
'Find any character before -
        .Text = "[!ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÀÄÇÈÒÖÙÜßçàäèéìòóöùü0123456789]-[!ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÀÄÇÈÒÖÙÜßçàäèéìòóöùü0123456789]"
'    .Text = "^?-"
    .Execute
  End With
Next iType
End Sub
Reply With Quote
  #6  
Old 10-11-2023, 01:42 AM
Italophile Italophile is offline Word macro to find any character (^?) without using Selection Windows 11 Word macro to find any character (^?) without using Selection Office 2021
Expert
 
Join Date: Mar 2022
Posts: 338
Italophile is just really niceItalophile is just really niceItalophile is just really niceItalophile is just really nice
Default

You don't need an equivalent. You just need .Text = "^?-"

If you are unsure of syntax just record a macro. The syntax for Find is identical whether it is used with Selection or a Range.
Reply With Quote
  #7  
Old 10-12-2023, 09:05 AM
RobiNew RobiNew is offline Word macro to find any character (^?) without using Selection Windows 10 Word macro to find any character (^?) without using Selection Office 2016
Competent Performer
Word macro to find any character (^?) without using Selection
 
Join Date: Sep 2023
Posts: 183
RobiNew is on a distinguished road
Default

Many thanks, Italophile!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird character appearing in Word at cursor position after using FIND cwword77 Word 11 06-13-2017 12:18 PM
Word macro to find any character (^?) without using Selection VBA/Macro & Allowing Multiple Hyperlinks Per Character/Word JustAboutNoon Word VBA 1 04-10-2015 11:27 PM
Word macro to find any character (^?) without using Selection macro to find a character and insert space so autocorrect will expand redzan Word VBA 3 05-22-2014 04:22 PM
Word macro to find any character (^?) without using Selection Macro ? - Checkbox in Word + drop down selection help dice1976 Word 4 07-24-2012 11:18 AM
*Word 2007 Macro for Character Count gbartlet Word 0 07-21-2010 11:12 AM

Other Forums: Access Forums

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