![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I have been using the following macro for a long time and it works great, one significant improvement is if I can get it to also change PreserveFormatOnUpdate = True, but I can't figure it out! Any help would be greatly appreciated!! Code:
Sub HyperlinkFormatting()
Dim fld As Field
Dim Resp
' If no documents are open then exit
If Documents.Count = 0 Then
Exit Sub
End If
' Confirm the action to format all the hyperlinks in the document
Resp = MsgBox("Are you sure you want to format all the hyperlinks in this document?", _
vbYesNo + vbQuestion + vbDefaultButton2, "Format Hyperlinks - Confirm?")
If Resp = vbNo Then
Exit Sub
End If
' Loop through all fields in the active document
For Each fld In ActiveDocument.Fields
If fld.Type = wdFieldPageRef Or _
fld.Type = wdFieldRef And InStr(1, fld.Code, "\h", 1) <> 0 Or _
fld.Type = wdFieldHyperlink Then
fld.Locked = False
fld.Result.Font.ColorIndex = wdBlue
End If
Next fld
End Sub
|
| Tags |
| field, hyperlink, vba |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Why are style updates in VBA not reflected in the document?
|
FlyingBlind | Word VBA | 5 | 02-16-2019 01:57 PM |
A mystery: how to hop about in a document, inserting updates in a single, new font?
|
markh10178 | Word | 3 | 11-26-2015 04:07 PM |
Updates tries to install Office 2010 updates which I don't use
|
jlumbtx | Office | 1 | 03-13-2015 04:50 PM |
| Automating document updates with new text | wordfoolish2 | Word | 0 | 01-04-2011 01:01 PM |
| Hyperlinks get messed when adding or deleting some slides? | Learner7 | PowerPoint | 0 | 05-17-2010 04:39 AM |