I have a Script that changes the hyplink in the text file but it’s not working
$msword = New-Object -ComObject Word.Application $msword.Visible = $true $doc = $msword.Documents.Open("C:\Outlook Signature Test 2016\Master\Master.docx") $links = $doc.Hyperlinks $links
Results from running the script
Application : Microsoft.Office.Interop.Word.ApplicationClass
Creator : 1297307460
Parent : Microsoft.Office.Interop.Word.DocumentClass
Name : https://www.microsoft.com/
AddressOld : https://www.microsoft.com/
Type : 0
Range : System.__ComObject
Shape :
SubAddressOld :
ExtraInfoRequired : False
Address : https://www.microsoft.com/
SubAddress :
EmailSubject :
ScreenTip :
TextToDisplay :
Target :
So I do this:
$msword = New-Object -ComObject Word.Application $msword.Visible = $true $doc = $msword.Documents.Open("C:\Outlook Signature Test 2016\Master\Master.docx") $links = $doc.Hyperlinks $links | gm
TypeName: System.__ComObject#{0002099d-0000-0000-c000-000000000046}
Name MemberType Definition
AddToFavorites Method void AddToFavorites ()
CreateNewDocument Method void CreateNewDocument (string, bool, bool)
Delete Method void Delete ()
Follow Method void Follow (Variant, Variant, Variant, Variant, Variant)
Address Property string Address () {get} {set}
AddressOld Property string AddressOld () {get}
Application Property Application Application () {get}
Creator Property int Creator () {get}
EmailSubject Property string EmailSubject () {get} {set}
ExtraInfoRequired Property bool ExtraInfoRequired () {get}
Name Property string Name () {get}
Parent Property IDispatch Parent () {get}
Range Property Range Range () {get}
ScreenTip Property string ScreenTip () {get} {set}
Shape Property Shape Shape () {get}
SubAddress Property string SubAddress () {get} {set}
SubAddressOld Property string SubAddressOld () {get}
Target Property string Target () {get} {set}
TextToDisplay Property string TextToDisplay () {get} {set}
Type Property MsoHyperlinkType Type () {get}
As you can see Address is there, but I keep getting an error:
Exception setting “Address”: “The property ‘Address’ cannot be found on this object. Verify that the property exists and can be set.”
At C:\Outlook Signature Test 2016\HLink.ps1:46 char:5
-
$links.Address = "https://www.leggmason.com/"}
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: ( , SetValueInvocationException
- FullyQualifiedErrorId : ExceptionWhenSetting
Please help me.