View Single Post
 
Old 12-10-2023, 06:22 PM
lisamarie lisamarie is offline Windows 11 Office 2021
Novice
 
Join Date: Dec 2023
Posts: 1
lisamarie is on a distinguished road
Default Cant get the submit button to open outlook

I have created my submit button, and entered the following code, however the outlook is not opening, so I cant send my form

Private Sub SubmitButton1_Click()
Label1.Visible = True
Dim OL As Object
Dim EmailItem As Object
Dim Doc As Document

Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save

With EmailItem
.Subject = "Complaint Form submitted"
.Body = "Please find attached complaint form"
.To = "dog.info@pncc.govt.nz"
.Importance = olImportanceNormal
.Attachments.Add Doc.FullName
.Send
End With

Application.ScreenUpdating = True

Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub
Reply With Quote