Hold on the flow of execution

Tejas Kore

Board Regular
Joined
Nov 2, 2017
Messages
72
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am trying to automate mail sending process. Now, the code which I have is working fine. But I want to add more functionality to it.

After ML.Display in the below code snippet, I want to hold on the flow of execution. ML.Display will display the mail which is ready. After that I want to add the functionality which is I should be able to send the mail by clicking on send mail button if i want and if I don't then I will close the mail template. Right now I am achieving the same functionality by using message box.

As soon as I take the action i.e. either I send the mail or I close the ready template then the flow which was hold off should resume execution.

.
. ML.To = Madd ' address
ML.CC = MaddCC 'CC
ML.Subject = "Testing"

ML.Display

answer = MsgBox("To continue select YES", vbYesNo)
If answer = vbYes Then
On Error GoTo ErrCatcher
ML.Send 'sending
Else
Mws.Cells(j, 9).Value = "Not Send"
End If
On Error GoTo 0
ErrCatcher:
If Err <> 0 Then Mws.Cells(j, 8).Value = "Name Resolution Failed"
'Else
' Mws.Cells(j, 9).Value = "Not Send"
'End If

j = j + 1
.
.
.

Any suggestions/solutions are welcome.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Edit: I just want to pause the execution right at display of the template(for editing). for each loop the execution should wait until "Send" or "close" buttons are clicked.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,175
Members
449,071
Latest member
cdnMech

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