Command Box Help!

lolzfidget89

New Member
Joined
Dec 12, 2012
Messages
3
Hi everyone,

I have created a command box to send an email:

Private Sub CommandButton1_Click()
ActiveWorkbook.SendMail "xxxxxx@xxxxxxx.com"
End Sub

The command button works, but I get a message saying the following "A program is trying to automatically send e-mail on your behalf. Do you want to allow this?" Any way to get rid of this? No worries if not - but this form will be used externally and I don't want my projects to get confused with it.

Is it possible for a msgbox to pop up before the email is actually sent? I want the message to read something like "Are you sure you want to proceed?" with the options "OK" "Cancel"

Thank you!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
this will do the message box thing that you want before sending the email

Code:
Sub stuff()
Dim resp As String
resp = MsgBox("Are you sure you wanna do do this?", vbOKCancel + vbQuestion)
If resp = vbCancel Then End
' now code to send the e-mail
End Sub

With regard to the other problem, I think that there is a product called redemption that can get round this, but I know little about it. If you search for redemption on this site or Google you may get more help.
Cheers
 
Upvote 0
Thanks! I'm now getting an error "Can't exit design mode because control text box 2 can not be created" This error didn't come up the first couple of times I tested it but for some reason it is now?
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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