Hello! i need a button where it will ask me to specify a cell. For example, i specified cell A1. Therefore automatically it will open the outlook and prepare an email with the content of A1, B1, C1, D1as per below. (3 other cells beside the one selected).
ps: ignore AW30 and AW31
Thank you!!
ps: ignore AW30 and AW31
Thank you!!
VBA Code:
Private Sub CommandButton196_Click()
Dim objOutlook As Object
Dim objNameSpace As Object
Dim objOlAccount As Object
Dim objMailItem As Object
Dim Recip As String
Dim Send As String
Dim rng As Range
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If objOutlook Is Nothing Then
Set objOutlook = CreateObject("Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
End If
Recip = "URGENT REMINDER! " & "Request # " & [A1].Value & " " & "Unit: " & [B1].Value & " " & "Description: " & [C1].Value & " " & "Request Date: " & [D1].Value & " Thank You!"
Send = [AW30].Value
SendCC = [AW31].Value
Set objMailItem = objOutlook.createitem(0)
With objMailItem
.To = Send
.CC = SendCC
.BCC = ""
.Subject = "Urgent Maintenance Request"
.Body = Recip
.display
End With
Set objMailItem = Nothing
Set objOlAccount = Nothing
Set objNameSpace = Nothing
Set objOutlook = Nothing
End Sub
Last edited by a moderator: