
Announcements
HI Everyone,
just need some assistance with a script - 2 issues actually.
1. I am using VB to create a script to use in Outlook and although it all works fine the link it opens is in Internet explorer and i can't get it to run under chrome or any other browser. I have used a shell etc. but can't get the link identified to run in the shell.
2. I would like to move the script to run in Power Automate so it runs regardless of if the computer is running or not. I know you can use Excel for running the script but haven't had much experience with it. The script is below. any assistance would be awesome.
_________________________________________________________________________________________________________________________________________
Sub OpenLinks(olMail As Outlook.MailItem)
Dim Reg1 As RegExp
Dim M1 As MatchCollection
Dim M As Match
Dim strURL As String
Dim oApp As Object
Set oApp = CreateObject("InternetExplorer.Application")
Set Reg1 = New RegExp
With Reg1
.Pattern = "Accept request now <(https?[:]//([0-9a-z\?:/\.&-^!#$%;_])*)"
.Global = False
.IgnoreCase = True
End With
If Reg1.Test(olMail.Body) Then
Set M1 = Reg1.Execute(olMail.Body)
For Each M In M1
strURL = M.SubMatches(0)
Debug.Print strURL
'wait for page to load before passing the web URL
Do While oApp.Busy
DoEvents
Loop
oApp.navigate strURL
oApp.Visible = True
Next
End If
Set Reg1 = Nothing
Set oApp = Nothing
End Sub