1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Sub hyperlinktransf()
Dim objdoc As Word.Document
Dim r As Hyperlink
Dim valeurVariable$, valeurVariable2$, nmVariable$
Dim premierpouc As Long, deuxiemepourc As Long
If Outlook.Application.ActiveInspector.EditorType = olEditorWord Then
Set objdoc = Outlook.Application.ActiveInspector.WordEditor
For Each r In objdoc.Hyperlinks
'recherche variable environnement
'initialisation
nmVariable = r.Address
valeurVariable$ = ""
'Recherche des caractères %
premierpourc = InStr(1, r.Address, "%25", vbTextCompare) + 3
deuxiemepourc = InStr(premierpourc + 1, r.Address, "%25", vbTextCompare)
If deuxiemepourc <> 0 Then
nmVariable = Mid(r.Address, premierpourc, deuxiemepourc - premierpourc)
'appel récupération variable environnement
If RécupèreValeurVariableEnvironnement(nmVariable, valeurVariable$) _
Then
MsgBox "La variable """ & nmVariable & """ n'existe pas !"
Else
r.Address = Mid(r.Address, 1, premierpourc - 4) & valeurVariable$ & Mid(r.Address, deuxiemepourc + 3)
If nmVariable = "HOMEPATH" Then
s = RécupèreValeurVariableEnvironnement("HOMEDRIVE", valeurVariable2$)
r.Address = valeurVariable2$ & r.Address
r.TextToDisplay = r.Address
End If
MsgBox r.Address
End If
End If
Next
End If
End Sub |
Partager