Hi Macropod, yes I use that code you did for me every day for converting definitions to our house style, couldn't be without it now it saves so much time.
I did try to copy that code and adapt it for what I require now but couldn't work out how to convert the manual (a), (b) etc. to our house style so (a), (b) may become 1.1.1 or even 1.1.1.1 - the source documents are converted from pdf as unformatted text then I have to convert to our house style - the numbering styles in the source documents can vary a lot and very rarely match our house style numbering.
I actually use one of your VBA codes I found online for house styling the numbering in documents which again is such a time saver.
Code:
Sub ManualToAutoHeading_ExcTables()
Application.ScreenUpdating = False
Dim Para As Paragraph, nextPara As Paragraph, rng As Range, iLvl As Long, n As Long, StyleName As String, wrd As Long, Count As Long
Dim i As Integer
Selection.Range.Style = "Body Text"
If Selection.Type = wdSelectionIP Then
MsgBox Prompt:="You have not selected any text!"
Exit Sub
End If
With Selection.Range
Set rng = Selection.Range
With rng
For Each Para In .Paragraphs 'Remove all leading spaces e.g tabs, spaces, NBS
For n = 1 To Para.Range.Characters.Count
If Para.Range.Characters(1).text = " " Or Para.Range.Characters(1).text = " " Or Para.Range.Characters(1).text = Chr(9) Or Para.Range.Characters(1).text = Chr(160) Then
Para.Range.Characters(1).Delete
Else: Exit For
End If
Next n
Next
For Each Para In .Paragraphs
If Para.Range.Information(wdWithInTable) = False Then
Set rng = Para.Range.Words.First 'Convert manual numbering to Heading numbering
With rng
If IsNumeric(.text) Then
While .Characters.Last.Next.text Like "[0-9. " & vbTab & "]"
.End = .End + 1
Wend
iLvl = UBound(Split(.text, "."))
If IsNumeric(Split(.text, ".")(UBound(Split(.text, ".")))) Then iLvl = iLvl + 1
If iLvl < 10 Then
.text = vbNullString
Para.Style = "Heading " & iLvl
End If
End If
End With
End If
Next
End With
Application.ScreenUpdating = True
End With
End Sub