hi
i am trying to have a message box then take user directly to email upon the problem what am i doing wrong?
red text works and creates the message, black text isnt working. also i only want an ok not ok/cancel
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 1 And Target.Column = 5 Then
If Target.Value = "_Approval Missing" Then
MsgBox "Notify the boss", vbOKCancel
If MsgBox = vbCancel Then SaveUI = True
If MsgBox = vbOK Then
'open outlook type stuff
Set OutlookApp = CreateObject("Outlook.Application")
Set OlObjects = OutlookApp.GetNamespace("MAPI")
Set newmsg = OutlookApp.CreateItem(olMailItem)
'add recipients
'newmsg.Recipients.Add ("Insert name")
newmsg.Recipients.Add ("name@emailaddress")
'add subject
newmsg.Subject = "Missing Approval"
'add body
newmsg.Body = "Updated document." & vbCrLf & "" & "Please getb approval"
newmsg.Display 'display
newmsg.Send 'send message
'give conformation of sent message
MsgBox "Outlook message sent", , "Outlook message sent"
End If
End If
End Sub
i am trying to have a message box then take user directly to email upon the problem what am i doing wrong?
red text works and creates the message, black text isnt working. also i only want an ok not ok/cancel
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 1 And Target.Column = 5 Then
If Target.Value = "_Approval Missing" Then
MsgBox "Notify the boss", vbOKCancel
If MsgBox = vbCancel Then SaveUI = True
If MsgBox = vbOK Then
'open outlook type stuff
Set OutlookApp = CreateObject("Outlook.Application")
Set OlObjects = OutlookApp.GetNamespace("MAPI")
Set newmsg = OutlookApp.CreateItem(olMailItem)
'add recipients
'newmsg.Recipients.Add ("Insert name")
newmsg.Recipients.Add ("name@emailaddress")
'add subject
newmsg.Subject = "Missing Approval"
'add body
newmsg.Body = "Updated document." & vbCrLf & "" & "Please getb approval"
newmsg.Display 'display
newmsg.Send 'send message
'give conformation of sent message
MsgBox "Outlook message sent", , "Outlook message sent"
End If
End If
End Sub