web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Script assistance - Ou...
Power Automate
Unanswered

Script assistance - Outlook - PA and Excel

(0) ShareShare
ReportReport
Posted on by

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

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard