Hi Guys ,
Could you please help me in correcting the below MACRO?
Wenrning it, I am getting a compile error: "End With without With" message.
Thanks a mill
' email Macro
Could you please help me in correcting the below MACRO?
Wenrning it, I am getting a compile error: "End With without With" message.
Thanks a mill
' email Macro
Code:
Set oOutlook =CreateObject("Outlook.Application")
Set oNameSpace =oOutlook.GetNameSpace("MAPI")
oNameSpace.Logon , , True
ans = MsgBox("Are you sure youwish to send this email?", vbYesNo)
If (ans = vbYes) Then
Set MItem = oOutlook.CreateItem(0)
With MItem
.To = Range("C4").Value
.Subject = Range("C7").Value
.Body = Range("C6").Value
If (.Range("B8").Value <>"") Then
.Attachments.AddRange("B8").Value
If (.Range("C8").Value <>"") Then
.Attachments.AddRange("C8").Value
If (.Range("D8").Value <>"") Then
.Attachments.AddRange("D8").Value
.Display
End With
End Sub
Last edited by a moderator: