![]() See Run-a-Script Rules Missing in Outlook for more information and the registry key to fix restore it. ![]() Use this macro in a run a script rule to open the first link in a message.Ī security update disabled the Run a script option in Outlook 20's rules wizard. If InStr(strURL, "index") = 0 Then GoTo NextURL Set Selection = currentExplorer.Selection Set currentExplorer = objOL.ActiveExplorer 'Private Declare PtrSafe Function ShellExecute If InStr(strURL, ".png") Then GoTo NextURL If InStr(strURL, "support") = 0 Then GoTo NextURL Remove that link from the code to open all links. This macro only opens links that contains the word 'support' somewhere in the path. This version of the macro opens links in the selected messages in any folder. You can confirm by adding Debug.Print olMail.Body to the macro then looking at the code in the Immediate window. The hyperlink should be seen by VBA in this format: View this thread. To do that, I need to include View this thread in the pattern search. If you want to open a link that is linked to a specific Hyperlink keyword, you'll need to find the keyword and url.įor example, in this screenshot, I have 10 links and want to open the fifth link, "View this thread". 'Private Declare PtrSafe Function ShellExecute _ Use it with care and on a folder containing a limited number of messages! Warning! This has the potential to lock up your computer. This macro opens the links in all messages in the selected folder. LSuccess = ShellExecute(0, "Open", strURL) ![]() If Right(strURL, 1) = ">" Then strURL = Left(strURL, Len(strURL) - 1) If InStr(strURL, "unsubscribe") Then GoTo NextURL Set olMail = Application.ActiveExplorer().Selection(1) Optional ByVal WindowStyle As Long = vbMinimizedFocus _ Lib "shell32.dll" Alias "ShellExecuteA" ( _ Private Declare PtrSafe Function ShellExecute _ If you are using 64-bit Office, the Private Declare Function ShellExecute macro will be in red - you need you use this as the first line, with PtrSafe between Declare Function: You will need to add a reference to the Microsoft VBScript Regular Expressions library in Tools, References! To open only the first link in a message, change. ![]() Warning! This has the potential to lock up your computer if you run it on a message containing a lot of hyperlinks. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |