![]() |
|
#16
|
|||
|
|||
|
Hi, Vivka! I'm trying to move until a specific character, but my code seems to be wrong. Can you help? Thanks!
Code:
Sub MovingChr()
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "<p class=MyPar>"
.Execute
End With
oRng.Collapse wdCollapseEnd
'If Selection is between > and < then move on to next <
If oRng.Characters.First = "<" Then
oRng.Collapse wdCollapseEnd
oRng.Select
oRng.MoveEndUntil Cset:="<"
oRng.Select
End If
End Sub
|
|
#17
|
|||
|
|||
|
Hi, RobiNew! Try this:
Code:
Sub MovingChr()
Set oRng = ActiveDocument.range
With oRng.Find
.text = "<p class=MyPar>"
.Execute
End With
If oRng.Characters.Last.Next Like "<" Then
oRng.MoveEnd unit:=wdCharacter, count:=1
oRng.MoveEndUntil Cset:="<"
oRng.Collapse wdcollapsend
oRng.Select 'to see the cursor psn; if you are going to work with oRng, this line can be deleted
End If
End Sub
Code:
Sub MovingChr()
Set oRng = ActiveDocument.range
With oRng.Find
.text = "<p class=MyPar>"
.Execute
End With
oRng.Collapse wdcollapsend
If oRng.Characters.First Like "<" Then
oRng.Move unit:=wdCharacter, count:=1
oRng.MoveUntil Cset:="<"
oRng.Select 'to see the cursor psn; if you are going to work with oRng, this line can be deleted
End If
End Sub
|
|
#18
|
|||
|
|||
|
Many thanks, Vivka! I'm really grateful.
|
|
#19
|
|||
|
|||
|
You are welcome, RobiNew! And one note: of course, you can use '=' instead of 'Like'.
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Foreign words/names Read Aloud | HanselM | Word | 1 | 05-01-2023 09:36 AM |
Removing microsoft build-in style names - display of style names in styles gallery changed
|
Firebody | Word | 8 | 03-06-2022 08:22 AM |
| How to find (highlight) two and more words in a list of 75k single words in Word 2010 | Usora | Word | 8 | 05-29-2018 03:34 AM |
| Need to extract domain names containing only specific words (MAJOR BULK) | Maxwell314 | Excel | 4 | 12-08-2014 05:10 PM |
| How to enter names in Resource Pool/names | pstein | Project | 1 | 03-26-2012 07:37 AM |