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!
 

pcc

Well-known Member
Joined
Jan 21, 2003
Messages
1,332
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
 

lolzfidget89

New Member
Joined
Dec 12, 2012
Messages
3
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?
 

Forum statistics

Threads
1,081,726
Messages
5,360,906
Members
400,602
Latest member
newaqua

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top