Compile error :”End with without with” – please help

Status
Not open for further replies.

GizmoL

New Member
Joined
Mar 25, 2019
Messages
4
Hi Guys J,

Could you please look at the below and help me?
When running it I am getting the above error message.
In advance, Thanks a million.
GizmoL.


' email Macro

Set oOutlook = CreateObject("Outlook.Application")Set oNameSpace = oOutlook.GetNameSpace("MAPI")oNameSpace.Logon , , True
ans = MsgBox("Are you sureyou wish 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








































 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Duplicate https://www.mrexcel.com/forum/excel...rror-end-without-please-help.html#post5248629

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

Note that sometimes posts from new users require Moderator approval before you can see them on the public forums. When this happens, you should see a message to that effect when you try to post it.
Please be patient and do not attempt to post the question again.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top