Hi,
I have created VBA to email a hyperlink to my spreadsheet. What I am looking to do now is be able to pick certain Outlook Distribution Groups to e-mail to? I have created a UserForm and the VBA but I am not sure how to put them together?
The code is as follows:
Sub EMail_Link()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
If ActiveWorkbook.Path <> "" Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<font size=""3"" face=""Calibri"">" & _
"<A HREF=""file://" & ActiveWorkbook.FullName & _
""">""" & ActiveWorkbook.FullName & _
""" </A>" & _
"<br><br>Thank you!"
On Error Resume Next
With OutMail
.Display
.To = ""
.CC = ""
.BCC = ""
.Subject = "**NEW WORK ORDER - " & Sheets("Work Order").Range("C9").Value & " " & Sheets("Work Order").Range("C4").Value
.HTMLBody = strbody & "<br>" & .HTMLBody
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Else
MsgBox "The ActiveWorkbook does not have a path, Save the file first."
End If
End Sub
I have attached the spreadsheet that has the UserForm started.
Any help would be greatly appreciated!
Thank you,
Sandi
Bookmarks