Attribute VB_Name = "Module1" Option Explicit Private Declare PtrSafe Function ShellExecute _ Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal hWnd As Long, _ ByVal Operation As String, _ ByVal Filename As String, _ Optional ByVal Parameters As String, _ Optional ByVal Directory As String, _ Optional ByVal WindowStyle As Long = vbMinimizedFocus _ ) As Long Sub DigalertWriteToFile() Dim ol As Outlook.Application Dim ns As Outlook.namespace Dim fol As Outlook.folder Dim i As Object Dim mi As Outlook.mailItem Dim s As String Dim n As Integer Dim EmAd As String 'Open "Z:\OCSurvey\Digalert\DigalertEmailOutlookExtraction.txt" For Output As #1 'Close #1 Set ol = New Outlook.Application Set ns = ol.GetNamespace("MAPI") Set fol = ns.GetDefaultFolder(olFolderInbox).Folders("Digalert") For Each i In fol.Items If i.Class = olMail Then Set mi = i s = CStr(mi.Body) n = FreeFile() Open "Z:\OCSurvey\Digalert\DigalertEmailOutlookExtraction.txt" For Append As #1 s = CStr(mi.Body) Debug.Print s Write #1, s ' other way of writing to file Close #1 End If Next i openUrl "https://ocgis.com/ocpw/DigAlert/DigAlertCreateGIS.html " End Sub ' WARINING: THIS MUST ONLY BE GIVEN SAFE URLs! ' DO NOT USE WITH DIRECT USER INPUT Private Sub openUrl(url As String) Dim lSuccess As Long lSuccess = ShellExecute(0, "Open", url) End Sub Public Sub openGoogle() openUrl "https://google.com" End Sub