|
|
I have an Excel macro that sends e-mails via Outlook, using the VBA "Send Method." For each message sent, Outlook displays a warning requiring a "Yes" response. Is there a way, either in Outlook or in the Excel macro, to generate an automatic reply to these messages?
|
|
Since that is using a Simple MAPI call none of the usual workarounds for using Outlook automation will work for you such as Redemption (www.dimastr.com/redemption). Try searching for "ClickYes" as a possible workaround for you when using Simple MAPI calls that trigger the Outlook object model guard.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm
"wpiet" <wpiet[ at ]discussions.microsoft.com> wrote in message news:BFED6239-94AD-41A6-8435-C51BE319996E[ at ]microsoft.com...
[Quoted Text] >I have an Excel macro that sends e-mails via Outlook, using the VBA "Send > Method." > For each message sent, Outlook displays a warning requiring a "Yes" > response. > Is there a way, either in Outlook or in the Excel macro, to generate an > automatic reply to these messages?
|
|
Thanks for the suggestion, Ken. I'll be looking into that. Is it possible to, alternatively, start from Outlook, access the Excel workbook & process the VBA macro there which creates the e-mails & sends them? I'm absolutely new at VB coding. I recorded the macro in Excel to set up the data for the e-mails, then had to figure out a way to add the code to that macro to create & send the e-mails using that data. Everything works perfectly except for having to manually reply to the "Object Model Guard."
Thanks, Will
"Ken Slovak - [MVP - Outlook]" wrote:
[Quoted Text] > Since that is using a Simple MAPI call none of the usual workarounds for > using Outlook automation will work for you such as Redemption > (www.dimastr.com/redemption). Try searching for "ClickYes" as a possible > workaround for you when using Simple MAPI calls that trigger the Outlook > object model guard. > > -- > Ken Slovak > [MVP - Outlook] > http://www.slovaktech.com> Author: Professional Programming Outlook 2007. > Reminder Manager, Extended Reminders, Attachment Options. > http://www.slovaktech.com/products.htm> > > "wpiet" <wpiet[ at ]discussions.microsoft.com> wrote in message > news:BFED6239-94AD-41A6-8435-C51BE319996E[ at ]microsoft.com... > >I have an Excel macro that sends e-mails via Outlook, using the VBA "Send > > Method." > > For each message sent, Outlook displays a warning requiring a "Yes" > > response. > > Is there a way, either in Outlook or in the Excel macro, to generate an > > automatic reply to these messages? > >
|
|
If you're going to write the code in Outlook, why not just send the emails from there? You'll have to recode the application, but it's a lot better than having Outlook start Excel only to send emails using Outlook.
HTH
On Dec 30, 5:17 pm, wpiet <wp...[ at ]discussions.microsoft.com> wrote:
[Quoted Text] > Thanks for the suggestion, Ken. I'll be looking into that. > Is it possible to, alternatively, start from Outlook, access the Excel > workbook & process the VBA macro there which creates the e-mails & sends them? > I'm absolutely new at VB coding. I recorded the macro in Excel to set up the > data for the e-mails, then had to figure out a way to add the code to that > macro to create & send the e-mails using that data. Everything works > perfectly except for having to manually reply to the "Object Model Guard." > > Thanks, > Will > > "Ken Slovak - [MVP - Outlook]" wrote: > > > Since that is using a Simple MAPI call none of the usual workarounds for > > using Outlook automation will work for you such as Redemption > > (www.dimastr.com/redemption). Try searching for "ClickYes" as a possible > > workaround for you when using Simple MAPI calls that trigger the Outlook > > object model guard. >
|
|
If you are running the code from the Outlook VBA project and you use Application there as your Outlook.Application object you will have a trusted Application object. Then you derive all of your other Outlook objects from that trusted Application object and those objects will be trusted. That will eliminate the security warnings.
You can use the Outlook VBA code to open Excel and the workbook you want and use code to extract the contents you want for the emails, all within your Outlook VBA code. That's the way I'd be doing it.
The Excel VBA macro code can be moved over to Outlook, you will need to add starter code to start Excel and open the workbook, and to fully qualify all Excel references (Excel.Range instead of Range, etc.). Then the code for the email can be done using Outlook automation code.
There should be examples of that sort of thing up on www.outlookcode.com, try searching there for "Excel" and see what turns up.
-- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm
"wpiet" <wpiet[ at ]discussions.microsoft.com> wrote in message news:85855780-1B38-4946-8125-71DA3ABFE4C5[ at ]microsoft.com...
[Quoted Text] > Thanks for the suggestion, Ken. I'll be looking into that. > Is it possible to, alternatively, start from Outlook, access the Excel > workbook & process the VBA macro there which creates the e-mails & sends > them? > I'm absolutely new at VB coding. I recorded the macro in Excel to set up > the > data for the e-mails, then had to figure out a way to add the code to that > macro to create & send the e-mails using that data. Everything works > perfectly except for having to manually reply to the "Object Model Guard." > > Thanks, > Will
|
|
My problem is that I don't have a clue what's possible from either application, since I've never programmed for either one (or done any other VBA coding). As it is, the Excel workbook contains 5 worksheets & the macro does numerous things, involving all of these sheets. The end result of the macro, before the For Each . . . Next loop that accesses Outlook & sends the e-mails, is a 2-column worksheet, one column with e-mail addresses, the other with the corresponding messages. Are you saying that, from an Outlook macro, I can open the Excel workbook, select that worksheet & loop through the rows, creating an e-mail for each one? Can I, in fact, do all the processing of the Excel workbook from the Outlook macro, using CreateObject("Excel.Application") as the starting point, opening the workbook & performing all the steps that are currently contained in the Excel macro? If so, I'm guessing it would mostly require changing the qualifiers on most statements???
Thanks, Will
"JP" wrote:
[Quoted Text] > If you're going to write the code in Outlook, why not just send the > emails from there? You'll have to recode the application, but it's a > lot better than having Outlook start Excel only to send emails using > Outlook. > > HTH > > > On Dec 30, 5:17 pm, wpiet <wp...[ at ]discussions.microsoft.com> wrote: > > Thanks for the suggestion, Ken. I'll be looking into that. > > Is it possible to, alternatively, start from Outlook, access the Excel > > workbook & process the VBA macro there which creates the e-mails & sends them? > > I'm absolutely new at VB coding. I recorded the macro in Excel to set up the > > data for the e-mails, then had to figure out a way to add the code to that > > macro to create & send the e-mails using that data. Everything works > > perfectly except for having to manually reply to the "Object Model Guard." > > > > Thanks, > > Will > > > > "Ken Slovak - [MVP - Outlook]" wrote: > > > > > Since that is using a Simple MAPI call none of the usual workarounds for > > > using Outlook automation will work for you such as Redemption > > > (www.dimastr.com/redemption). Try searching for "ClickYes" as a possible > > > workaround for you when using Simple MAPI calls that trigger the Outlook > > > object model guard. > > >
|
|
Thanks, Ken. I didn't see your post before my response to JP. Yours answered those questions of mine. Sounds like we're all on the same page, essentially. I think I'm getting the idea. Thanks to both of you. You've been very helpful.
Will
"Ken Slovak - [MVP - Outlook]" wrote:
[Quoted Text] > If you are running the code from the Outlook VBA project and you use > Application there as your Outlook.Application object you will have a trusted > Application object. Then you derive all of your other Outlook objects from > that trusted Application object and those objects will be trusted. That will > eliminate the security warnings. > > You can use the Outlook VBA code to open Excel and the workbook you want and > use code to extract the contents you want for the emails, all within your > Outlook VBA code. That's the way I'd be doing it. > > The Excel VBA macro code can be moved over to Outlook, you will need to add > starter code to start Excel and open the workbook, and to fully qualify all > Excel references (Excel.Range instead of Range, etc.). Then the code for the > email can be done using Outlook automation code. > > There should be examples of that sort of thing up on www.outlookcode.com, > try searching there for "Excel" and see what turns up. > > -- > Ken Slovak > [MVP - Outlook] > http://www.slovaktech.com> Author: Professional Programming Outlook 2007. > Reminder Manager, Extended Reminders, Attachment Options. > http://www.slovaktech.com/products.htm> > > "wpiet" <wpiet[ at ]discussions.microsoft.com> wrote in message > news:85855780-1B38-4946-8125-71DA3ABFE4C5[ at ]microsoft.com... > > Thanks for the suggestion, Ken. I'll be looking into that. > > Is it possible to, alternatively, start from Outlook, access the Excel > > workbook & process the VBA macro there which creates the e-mails & sends > > them? > > I'm absolutely new at VB coding. I recorded the macro in Excel to set up > > the > > data for the e-mails, then had to figure out a way to add the code to that > > macro to create & send the e-mails using that data. Everything works > > perfectly except for having to manually reply to the "Object Model Guard." > > > > Thanks, > > Will > >
|
|
|