![]() |
|
#1
|
|||
|
|||
|
I need a word macro to find any character without using Selection. In other words I need the equivalent of '^?'. Thanks!
|
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
Thank you, but I don't want to find just 'things'. I need the equivalent of '^?'.
|
|
#4
|
|||
|
|||
|
And you can modify code that you already have to do that. It isn't difficult to do.
|
|
#5
|
|||
|
|||
|
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
|
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
Many thanks, Italophile!
|
|
| Thread Tools | |
| Display Modes | |
|
|
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 |
VBA/Macro & Allowing Multiple Hyperlinks Per Character/Word
|
JustAboutNoon | Word VBA | 1 | 04-10-2015 11:27 PM |
macro to find a character and insert space so autocorrect will expand
|
redzan | Word VBA | 3 | 05-22-2014 04:22 PM |
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 |