Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 02-01-2019, 03:36 AM
mroatman mroatman is offline URL formatting + a new question Mac OS X URL formatting + a new question Office 2019
Novice
URL formatting + a new question
 
Join Date: Jan 2019
Location: Tallinn, Estonia
Posts: 9
mroatman is on a distinguished road
Default

As I continued to play around, I was able to achieve what I was looking for. It seems the key was to un-automate the bullet lists via:

ActiveDocument.ConvertNumbersToText

My final input is probably the messiest code on the planet, and I'm sure there are numerous ways to simplify what I have done. But it finally works. So for posterity, in case it's ever helpful to someone else in the future, I will post it below.

Quote:

Sub TopiaFormat()
'
' TopiaFormat Macro
'

ActiveDocument.ConvertNumbersToText

Dim Para As Paragraph, Rng As Range
For Each Para In ActiveDocument.Range.Paragraphs
With Para.Range
If .Text Like "?" & vbTab & "*" Then
Set Rng = .Duplicate
With Rng
.End = .Start + 2
.Text = vbNullString
.InsertBefore Chr(149) & vbTab
End With
End If
End With
Next

With Selection.Find
.ClearFormatting
.Text = "^0233"
.Replacement.ClearFormatting
.Replacement.Text = " - "
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With

With Selection.Find
.ClearFormatting
.Text = "ï"
.Replacement.ClearFormatting
.Replacement.Text = "[*]"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With

With Selection.Find
.ClearFormatting
.Text = "[*]^w"
.Replacement.ClearFormatting
.Replacement.Text = "[*]"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With

With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p^p^p"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With

Dim HLnk As Hyperlink
For Each HLnk In ActiveDocument.Hyperlinks
HLnk.Range.InsertAfter "]"
Next

For Each HLnk In ActiveDocument.Hyperlinks
HLnk.Range.InsertBefore "[>" & HLnk.Address & "|"
Next

Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = wdFieldHyperlink Then
oField.Unlink
End If
Next
Set oField = Nothing

ActiveDocument.Select
Selection.ClearFormatting

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing a comment with underline or other formatting (or adding that formatting to commented text) paulkaye Word 4 05-16-2016 05:38 AM
URL formatting + a new question The Logic Behind Apply Formatting of Surrounding Text in Reveal Formatting Pane Instructor Mark Word 4 04-06-2016 01:32 PM
URL formatting + a new question How to do a find and replace on formatting for partial word formatting. BrianSvanvik Word 2 09-04-2015 01:20 PM
Find and Replace, Formatting, Formatting Formula kjxavier Word 1 07-04-2014 09:11 AM
Formatting contents after Tab of continuous lines or formatting specific area of word pawii Word 1 05-12-2014 05:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft