Prevent e-mail if condition not met

Niven

New Member
Joined
Aug 23, 2011
Messages
45
Hi, What is wrong with this code?Sub Send_via_email(Cancel As Boolean)'' Send_via_email Macro' Dim blnCancel As Boolean Dim sMail As String Dim rngCell1 As Excel.Range, rngCell2 As Excel.Range sMail = Application.Dialogs(xlDialogSendMail).Show blnCancel = Not Sheets("Weekly Timesheet").Range("C44").Value If blnCancel Then Call MsgBox(Prompt:="Have ALL hours worked been allocated correctly?", Title:="Cannot send e-mail", Buttons:=vbExclamation + vbOKOnly)' If Cancel = blnCancel Then sMail End IfEnd Sub
 
Thanks for always being helpful. No worries I figured out what the problem was. A new workbook is created and then e-mailed. I was a bit dumb in that I was clicking the button on the new workbook on the second computer and obviously there is no code there since it is on the original file. The original file works on other computers. Thanks anyway. You've really been a great help!!
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,215,548
Messages
6,125,468
Members
449,230
Latest member
ASBeard

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