Close Window   
Free Ebook
Got an Excel Question?
Ask it in our Excel forum!
TeachExcel.com
Subscribe for Free Excel tips & more!
E-mail:
Advertisements



Outlook Voting Button

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

To whom it may concern,

How do I include "Voting Buttons" in an Outlook email message using a macro
from Excel 2003? I have tried adding them as objects within the email
portion of the macro code, but have not been successful. Any help would be
greatly appreciated.


TIA
Andrew Sbrana
Senior Business Analyst




View Answers     

Similar Excel Tutorials

What is a Macro in Excel?
This is the first step to learning about Macros for Excel and how to use them. What is a Macro?   A macro is a smal ...
Run a Macro When you Click a Button in Excel
Make a macro run when you click a button in the worksheet in Excel. This allows you to create a button and put it a ...
Make Professional Looking Rounded Buttons in Excel
How to make professional looking rounded buttons in Excel. This allows you to avoid using basic buttons and also to ...
Enable the Analysis ToolPak in Excel
How to enable the Analysis ToolPak in Excel. This is an add-in program that comes with Excel and allows you to use ...

Helpful Excel Macros

Email Current Workbook & or Other Attachments
- This macro will send the current workbook in an email through Microsoft Outlook. The Macro allows you to send the most
Send Emails through Outlook using Email Addresses from Excel and text from Word
- This macro allows you to send an email to a list of recipients through excel. The email will be sent through Outlook an
Open Microsoft Outlook from Excel
- This free macro will open the Microsoft Outlook program on your computer. You do need to have this program first. This
Macro to add a New Line to Message Box Pop-up Windows in Excel
- This is a very simple Message Box, pop-up window, macro for Excel that illustrates how to put new lines, the same thi
Display The Actual Link / Email Address From Links in Excel - UDF
- Display the actual link or email address from links within Excel with this UDF. This user defined function pulls the ac

Similar Topics







Hi All,

I've got the below code that sends an E-mail from outlook via VBA coding in a macro, I would like someone to help me add into the code the following;

Custom Voting Buttons: Approve; Reject; Hold ECS
Redirect replies to another E-mail address.

VB:

Dim Email_Subject, Email_Send_To, Email_Cc, Email_Bcc, Email_Body As String 
Dim Mail_Object, Mail_Single As Variant 
 
Email_Subject = "Automatic Message: Re-sale Register" 
Email_Send_To = "[EMAIL="TestEmail@Test.co.uk"]TestEmail@Test.co.uk[/EMAIL]" 
Email_Bcc = "[EMAIL="AnotherEmail@Test.co.uk"]AnotherEmail@Test.co.uk[/EMAIL]" 
Email_Body = "New comments have been added to a part you've subscribed to" 
On Error Goto debugs 
Set Mail_Object = CreateObject("Outlook.Application") 
Set Mail_Single = Mail_Object.CreateItem(0) 
With Mail_Single 
    .Subject = Email_Subject 
    .To = Email_Send_To 
    .BCC = Email_Bcc 
    .Body = Email_Body 
    .send 
End With 
debugs: 
If Err.Description <> "" Then MsgBox Err.Description 


If you like these VB formatting tags please consider sponsoring me in support of injured Royal Marines



I know the following question is not to do with Excel but it's related and I need to re-think how to do the above if this isn't possible:
Is it possible to have an E-mail address in outlook look at all incoming E-mails and change a spreadsheet depending on what the E-mail says?

I know theres a few complex questions, feel free to ask more.

Thanks,
Ranmaru2

Hi. I'm trying to send an email to several hundred people using an excel database containing the email address and a customer reference number. I want the email to have a subject line containing the reference number. Can anyone help me with this?

What's more I need the email body to contain some static text, BUT for the recipient to reply to a fixed email address using voting buttons. I thought maybe replacing the voting buttons with maybe a mailto hyperlink which populates the reply subject with the vote option and the reference number.

Any help you can give would be greatly appreciated.

Many thanks,
Mark


I have created a macro which sends an email out with voting buttons Approve and Reject.
Problem is, when the receiver of the email hits Approve, it only gets send to the sender of the origin email (user of the program). I wanted it set up so that when the receiver hits Approve,it gets sent to the user of the program as well as me. I tried putting both names in the TO field but the response only gets sent to the user of my application that sent the email out. Is there any way to get around this?


HI please can you help. I am not good with code and was wondering if the following is possible.

I have managed to pull together a code, which is probably not the best of code and a mixture of all different things but seems to work so far. It currently emails an attachment to a supervisor email address and cc's. to an administrator email address. The email generated also has the voting buttons included however, When you use the voting option to reply it is only sent to the person who it, is there a way of also replying to the administrator cc email address?

I hope the above make sense


Hi

I've had assistance in creating pdf's in Excel 2003 using VBA. The macro creates pdf's for all sheets (from sheet 4 onwards) and saves them as follows: c:\temp\"sheet name".pdf

I would also like to e-mail the created pdf every time using Outlook 2003. This will be e-mailed to different e-mail addresses using the macro. I will put the email address somewhere on the relevant sheet (e.g. cell A1).

I attach an example spreadsheet including the current code creating the pdf's.

I have also noted that Outlook 2003 automatically gives a security warning because "another program is trying to access Outlook". Is it possible to have the macro "delete" or "ignore" this message automatically?

Thank you!
Bruwer


hi everyone,

What i need to do is fairly simple but i can't manage to do it...

What i need is a Macro that can do the following:

i want a serie of button called "coaching" on row h4 to h1000, all the button are identical and do the same purpose.

When we click on the button i want the name to change from "coaching" to "email sent", and i want outlook to open with a email adress in the "to" field, and want the subject of the email to be "agent that need coaching".

So each time i fill a row, if i need a coaching to be done, i click the coaching button and it open up outlook with a "to" and a "subject", and i can then, manually finish the email.

So a quick resume:
series of button that fit individually in cell h4 to h1000, called coaching
when i click it change to email sent
And open outlook with a "to" email and "subject" prefilled.

Anyone can help?


I have an Excel macro that sends an Outlook message with an attachment. The code works perfectly, but the request to send the email does result in the message: "A program is trying to send email on your behalf...".

I found a similar problem noted he

http://www.mrexcel.com/forum/showthr...hlight=outlook

One of the three solutions offered was to sign one's macros. I've done that (internal digital certificate) and have configured both Excel and Outlook to "honor" this signed macro by having them listed under Tools, Macro, Security/Trusted Publishers.

I still get the message about the email. I tried this under both High and Medium level security.

Our IT infrastructure guys tell me that there is nothing that they have in place that would cause this to occur.

Does anyone know why this is occurring? I'm running Outlook 2003 SP3 and Excel 2003 SP3.


Hi,

I have added voting buttons to the following macro, is there anyway og getting the voting buttons to reply to multiple recipients or in the case "email1"

Sean
________________________________________________________
Sub Button12_Click()
ThisWorkbook.Save
'
'
Dim myOutlook As Object
Dim myMailItem As Object
Set otlapp = CreateObject("Outlook.Application")
Set otlNewMail = otlapp.Createitem(olMailItem)
fname = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
Email1 = Cells(10, 2).Value
requistioner = Cells(4, 2).Value

With otlNewMail
.To = " "
.CC = Email1
.Subject = " "
.Body = Chr(13) & "Hi," & Chr(13) & Chr(13) & "Please process the attached order at your earliest convenience" & Chr(13) & Chr(13) & "Regards," & Chr(13) & requistioner & Chr(13) & Chr(13)
.VotingOptions = "Accept;Reject"
.Attachments.Add fname
.Display
End With
End Sub




I have an excel workbook that I must email out to my team on a daily basis. The excel workbook needs to be refreshed daily from two text files that are downloaded from our wms system. The text files are imported to the excel workbook and the workbook is emailed to the team. I am trying to automate this so I do not have to open the excel workbook, click data, refresh all, choose the files to refresh, click the office button, click send, as email attachment, type in the email address and click send.

I did come across the following VB code that is very helpful to me although I have one concern. The concern is that when this workbook is emailed out to the team and they open it, I think the macro will run and import the data and email the workbook again. I can see some people opening the emails continuously and creating a repetitive loop that can be very frustrating to others on the email chain.

Is there a way to have the VB code do everything but only on my side and not run the VB macro when the email is sent?

Sub Auto_Open()
'
' Auto_Open Macro
' refresh data and send email
'

'
ActiveWorkbook.RefreshAll
ActiveWorkbook.Save
'

' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
' This example sends the last saved version of the Activeworkbook object .
Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.To = "enter email address"
.CC = ""
.BCC = ""
.Subject = "Daily Report"
.Body = "Attached is the daily report."
.Attachments.Add ActiveWorkbook.FullName
' You can add other files by uncommenting the following line.
'.Attachments.Add ("C:\test.txt")
' In place of the following statement, you can use ".Display" to
' display the mail.
.Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

ActiveWorkbook.Close True

End Sub

I'm using a standard little Excel macro to send an individual email to each person in a list:

Code:

With ActiveSheet
    Msg = "All," & Chr(10) & Chr(10) & "As part of normal support and maintenance, this week we updated your store to v" & .[X1] & Chr(10) & Chr(10) & "Any questions please contact me directly."
    Set Emails = .Range("T2", .Range("T" & .Rows.Count).End(xlUp)).SpecialCells(xlFormulas, 2)
    
    For Each Email In Emails
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)

        Subject = Email.Offset(, -19) & " - System Update"
        With OutMail
            .To = Email.Text
            .CC = ""
            .BCC = ""
            .Subject = Subject
            .Body = Msg & Chr(10) & Chr(10) & Signature
            '.Display   'or use .Send
            .Send
        End With
        Email.Offset(, -1) = "Done"
    Next Email
End With



Problem, I'd like to set the "Save Sent Message To:" option on each of these emails, too, to file this email into a specific archival folder in Outlook. Is there a way to do this in Excel VBA? I could just copy all these emails manually out of the SENT EMAILS folder, but if it's possible to file them using the macro, even better.


Bonus question: Is there any way to add an existing Signature in Outlook to these emails? I have a default signature that occurs automatically on all NEW emails I create in Outlook, but this VBA method of creating an email does not get that default signature, seems to skip that. In the code above I'm using another signature I created for the macro, but it's not the cool formatted signature I have usually in Outlook.




(also posted here with no response so far...)


Excel Gurus,

I am using outlook 2003, and currently I am trying to run this email macro on my excel and send an excel file to specific email. And when i execute the code, Mic. outlook popup a window saying
"A program is trying to access e-mail address stored in outlook. Do you want to allow this? then i have to check the allow access box and select the minutes. Is there anyway I can bypass this or automate this in the macro?

Thanks for all the help.


I have a macro that sends a worksheet via email [Outlook] to a list of recipients. Everytime an email is created, outlook pops up a confirmation window and waits for user input "yes".


Can I set up vba or outlook to skip that step?

I really want to create a macro with a loop to go through a list of files, execute a macro in each one, save the files and send emails to various people. This process will create about 40 emails and I don'd want the admin person to have to sit there and confirm each message going out.

Any help would be apprecited.
modytrane


Hi Guys,

I have a spreadsheet with a number of different actions with various different dates associated to them. Is it possible to create a macro that will automatically send an email to my outlook inbox (or somebody elses) when the date is due or upcoming?

Also is it possible to include different content in the email based on say the title of the action etc?

Any help would be greatly appreciated, thanks in advance




Hi All,

I have had great help on this site getting code working to send contents of Excel via Outlook. Now I have had a request to make this work via MAC too< i don't have a MAC and know nothing about them. :-(
(Please note I have no experience in code, everything I have picked up from help on this site and generally it is a copy and paste exercise rather than an understanding)

To give as much info as possible.

At the moment I have a excel sheet with 5 buttons, you click the button and a macro is run to populate the required fields to be completed for that button. There is then a EMAIL button which is clicked to copy and paste the contents from the Excel spreadsheet into Excel, everything is working great for this for Outlook (all thanks to help from this site and a couple of other websites I have been pointed to)

Now I need to get this working for MAC. I have been pointed to a site but I really can't work things out. What I need to know is.

A. How do I change the code below to work for MAC.
B. How will I identify if a MAC or Outlook user? Would I need two buttons ;CLICK HERE TO EMAIL ON MACS' AND 'CLICK HERE TO EMAIL ON OUTLOOK' or is there something more clever than this.

Any help really appreciated.


Attached spreadsheet containing the full code used at the moment to email the contents. (The code behind the click here to email button)

I'm looking for a sample of code to open an excel file attached to an outlook message.

1) Preferably, from the selected email in my inbox
2) Also good, from the current open message
3) Best, to loop through all emails in a specific outlook folder and either open the files or save them to a specific directory.

Thanks if anyone has suggestions - my attempts at working with outlook objects hasn't proved too successful yet.

AB


I currently use the following code to open any of my 4 types of email accounts, such as hotmail, gmail, juno etc. Now I am adding Outlook and I don't know how to incorporate it into my code.

As an Ex: I have a seperate worksheet that I place the name hotmail.com and the following code will open it. I use a separte cell for each email address along with a separate macro for each email name.

I doubt that I can use this same code. I think that I have to use Outlook.exe ?????

Help would be appreciated.

Code:

Sub OpenMyeMailNo2()
Dim oShell
Dim sUrl As String
 sUrl = "http://" & Sheets("Setup").Cells(9, 5).Value
    Set oShell = CreateObject("Wscript.Shell")

    oShell.Run (sUrl)
End Sub





The first two parts of this macro work just fine, it's the closing part of it which doesn't work. The strange thing is, if I isolate the close part of the macro and run it as it's own macro, it will work. However, it will not work as part of a larger macro, or even if called from a higher macro which contained the open portion. Here is my code:

Code:

Sub launch_send_close_outlook()

'launch Outlook
Dim Outlook As Outlook.Application
Set Outlook = CreateObject("Outlook.Application")
Dim ns As Outlook.Namespace
Dim Folder As Outlook.MAPIFolder
Set ns = Outlook.GetNamespace("MAPI")
Set Folder = ns.GetDefaultFolder(olFolderInbox)
Outlook.Explorers.Add Folder
    
    'send email
    Set myOlApp = CreateObject("Outlook.Application")
    Set mailItem = myOlApp.CreateItem(olMailItem)
    Set myRecipient = mailItem.Recipients.Add("name@domain.com")
    mailItem.body = "testing"
    mailItem.Subject = "test email"
    mailItem.Send

'close Outlook
Set Outlook = CreateObject("Outlook.Application")
Outlook.Quit
Set Outlook = Nothing

End Sub


If anyone can explain what I'm doing wrong with the last part, I would appreciate it. Also, if any other part of my code could use some cleaning up, feel free to let me know.

Thanks!


Is there any way of getting the voting buttons in Outlook to automatically reply to multiple recipients


Please help!!

I have a macro that will send the active spreadsheet and also a specified file as an attachment in an email using Outlook, but I want to be able to choose the email address rather than specifiying one in the macro. Here's my code:

Sub Macro4()
Dim aOutlook As Outlook.Application, aEmail As Outlook.MailItem
Set aOutlook = GetObject(, "Outlook.Application")
If aOutlook Is Nothing Then Set aOutlook = New Outlook.Application
Set aEmail = aOutlook.CreateItem(olmailitem)
aEmail.Subject = "I/E Report"
aEmail.Body = "The report that you requested is attached."
aEmail.Recipients.Add "abc@company.com"
aEmail.Attachments.Add "C:\My Documents\CURRENTGL.XLS"
aEmail.Attachments.Add ActiveWorkbook.FullName
aEmail.Send
End Sub

Any suggestions would be greatly appreciated. I have just started working with VBA.
Thanks, Shannon


I'm putting this in the Excel section, but what I want to do is have one of my Excel macros run upon receipt of an automated email in my Outlook inbox. I setup a rule to monitor my Outlook mail looking for this specific email message. Right now it displays a message box to alert me when the message has arrived. Does anyone have an example of how I can modify the code and have it automatically run a macro from one of my Excel files?




Hi,
What I would like is a macro to send an email from outlook to each person from a list in excel. The table would look like this:


No. Name Email 1 name1 email 1 2 name2 email 2 3 name3 email 3 4 name4 email 4




This list would vary in size so excel should stop when it gets to a blank cell.

The email would preferably be saved in a folder in outlook called Templates (or in the Drafts folder). It would read something like this:

{name}, thank you for your support
{Order Number}

The email must be in HTML format as the email will contain images in the body of the email.

I have a macro (attached) that works perfectly, but the images in the body of the email appear as a red cross even when I press download images.

Any help would be greatly appreciated.

Thanks

Hi, I'm using Windows XP SP2. I have an email that comes in via outlook 2003. It has a .csv attachment. I'd like to write a macro that can be activated from outlook to open the email, and get the data from the .csv file to a .mdb file using ADO. Any ideas or any better forums to ask this in? Thx Turbo


Can someone point me to a good Outlook forum? I'm looking for a macro to auto reply to all emails sent to a specific email address (Outlook has such a capability, but it limits a reply to only the first email received from each sender). After the reply is sent, the email would be moved to a "completed" folder.


Hi guys.

I am trying to create a simple Macro in Outlook (2002) which will send a reply back to the original email recipient with specific text in the subject and body. (I know I could probably do this using Rules but I need to be able to manually choose who to send this reply to.)

I found some VBA and tailored it to suit but when I click on the menu button that I linked to this Macro, I get a prompt saying, "A program is trying to automatically send e-mail on your behalf..." and you need to click YES to send it. If you click NO, you get a debug error.

Is there something in the code (copied below) that I can add/amend to stop this prompt from appearing? (I thought this message only appeared if you use VBA from another program, not when entering VBA directly into Outlook.)

Also, when I click on the Macro button, it opens up the auto-reply in a new window so that I'm still left with the original email open. Is there a line of code I can enter that will close this email too? I would appreciate your help.

Sub EmailReply()
Dim Reply As Outlook.MailItem
Dim Original As Outlook.MailItem
Set Original = Application.ActiveExplorer.Selection(1)
Set Reply = Original.Reply
Reply.Attachments.Add Original
Reply.Subject = "Important Notice"
Reply.Body = "Body text to be entered here"
Reply.Display
Reply.Send
End Sub

Thanks.

Richard


I have been very successful in using the 1st macro to insert specific data from a spreadsheet into an email and send it. The only problem is that I need to send it from a specific account in Outlook. I found the 2nd macro which works to send from a specific account in Outlook but I am not able to find something similar to work with Excel and integrate with the 1st code. If anyone can help me, this would be more than appreciated!

1st Macro

Code:

Private Declare Function ShellExecute  _ 
  Lib "shell32.dll" _
    Alias "ShellExecuteA" _ 
      (ByVal hwnd As Long, _ 
       ByVal lpOperation As String, _
       ByVal lpFile As String, _ 
       ByVal lpParameters As String, _ 
       ByVal lpDirectory As String, _
       ByVal nShowCmd As Long) As Long

Sub SendEMail()
    Dim Email As String, Subj As String
    Dim Msg As String, URL As String
    Dim r As Integer, x As Double
    For r = 2 To 4 'data in rows 2-4
'       Get the email address
        Email = Cells(r, 2)
        
'       Message subject
        Subj = "Your Annual Bonus"

'       Compose the message
        Msg = ""
        Msg = Msg & "Dear " & Cells(r, 1) & "," & vbCrLf & vbCrLf
        Msg = Msg & "I am pleased to inform you that your annual bonus is "
        Msg = Msg & Cells(r, 3).Text & "." & vbCrLf & vbCrLf
        Msg = Msg & "William Rose" & vbCrLf
        Msg = Msg & "President"
        
'       Replace spaces with %20 (hex)
        Subj = Application.WorksheetFunction.Substitute(Subj, " ", "%20")
        Msg = Application.WorksheetFunction.Substitute(Msg, " ", "%20")
                
'       Replace carriage returns with %0D%0A (hex)
        Msg = Application.WorksheetFunction.Substitute(Msg, vbCrLf, "%0D%0A")        

'       Create the URL
        URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Msg
        
'       Execute the URL (start the email client)
        ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus

'       Wait two seconds before sending keystrokes
        Application.Wait (Now + TimeValue("0:00:02"))
        Application.SendKeys "%s"
    Next r
End Sub


2nd Macro

Code:

Sub NewMail()

  Dim objOLApp As Outlook.Application
  Dim NewMail As Outlook.MailItem

    Set objOLApp = New Outlook.Application
    Set NewMail = objOLApp.CreateItem(olMailItem)

      NewMail.SentOnBehalfOfName = "email@domain.com"
      NewMail.Display

End Sub