![]() |
|
#1
|
|||
|
|||
![]()
Shelly,
It is hard to tell what you want the code to do without and sample before and after document attached. You can try: Code:
Sub ProcessNum() Dim oRng As Range Dim lngIndex As Long Dim bAllNums As Boolean bAllNums = True Set oRng = oRngNum.Duplicate oRng.Collapse wdCollapseEnd Do Until IsNumeric(oRng.Characters.First.Previous) oRng.MoveStart wdCharacter, -1 Loop oRng.Text = "." & vbTab oRngNum.End = oRng.Start For lngIndex = 1 To oRngNum.Characters.Count If Not IsNumeric(oRngNum.Characters(lngIndex)) Then If oRngNum.Characters(lngIndex) = " " And oRngNum.Characters(lngIndex).Previous = "." Then oRngNum.Characters(lngIndex).Delete lngIndex = lngIndex + 1 Else oRngNum.Characters(lngIndex) = "." bAllNums = False End If End If Next If Not bAllNums Then oRngNum.Characters.Last.Next.Delete lbl_Exit: Exit Sub End Sub |
#2
|
|||
|
|||
![]()
Hi Greg, I have attached before being rund, after being run and what the code should do after being run if that helps.
Before.docx Attachment 20943 Attachment 20942 Last edited by Shelley Lou; 09-30-2024 at 06:45 AM. Reason: Adding test document |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Shelley Lou | Word VBA | 1 | 03-05-2023 03:45 AM |
![]() |
Shelley Lou | Word VBA | 2 | 08-04-2021 12:24 AM |
![]() |
Shelley Lou | Word VBA | 8 | 05-28-2021 01:08 AM |
![]() |
stanley | Word | 4 | 12-15-2020 10:59 AM |
page numbering for manual | Bursal | Word | 1 | 07-29-2018 02:08 PM |