Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA SendMail & that stupid warning box

Status
Not open for further replies.

Cervantes

MIS
Apr 1, 2003
147
CA
Hi!
I'm hoping someone here can help me be stubborn :) I use VBA to send several hundred emails to our corporate customers, and ever since that wonderful SR-1 patch, I get the "A program is trying to automatically send e-mail on your behalf" error. Now, I have been using ClickYes as a stopgap, but I want to actually code things so that I don't have to use that anymore. I recall when this first came up seeing some code ideas that would help, but I can't find them anymore.

So, here's where I'm at. Exchange environment, Outlook 2003, no I can't get the sysadmin to change the security setting, and I'd like to use regular VBA instead of an addin like Outlook Redemption, if it's possible, as I'd like the code to be portable with as little hassle as possible.

Here's my snippet as it is now:
Code:
            ActiveWorkbook.SaveAs "G:\Files\" & strCustomerName & " - " & ReportMonth, xlWorkbookNormal
            Set OutApp = CreateObject("Outlook.Application")
            Set OutMail = OutApp.CreateItem(olMailItem)
            With OutMail
                .To = strMailGroup 'a variable preloaded with the email addy
                .CC = ""
                .BCC = ""
                .Subject = "Our Company " & ReportMonth & " eBilling - " & strCustomerName
                .Attachments.Add ActiveWorkbook.FullName
                .Body = TextBody & SpecialMessage & Signature
                .Send
            End With
            Set OutMail = Nothing
            Set OutApp = Nothing
            ActiveWorkbook.Close

I'd really appreciate any tips anyone has. I've been googling, but I'm still trying to decipher which solutions will work with Exchange, and which require SMTP.

Cheers!
Cerv
 
Do a google search for outlook object model guard

Can't you play with CDO ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Actually, I was just looking at CDO. :) However, it looks like it's SMTP, and I am behind a corporate firewall and can't do any SMTP. I'm stuck with Exchange only.
 
hummm. even if you have a firewall, surely your company has an internal Mail server.. just a question of setting it up to allow relay of SMTP mail to authenticated users.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Hi fredericofonseca;
Yes, we do have an internal Exchange server... along with a very inflexible Exchange administrator who refuses to make any changes to the system at all. "Absolutely no SMTP" is the word. :(
I broke down and installed Redemption to test it out, but I'd still be much happier if there was a solution that didn't involve 3rd party apps, that worked on unmodified Exchange.

-Cerv
 
Do not send, display it and sendkeys!

We just upgraded to Office2003 and that amendment works for me!

'.Send
.Display
SendKeys "%{s}", True 'This sends the e-mail (won't work if you are stepping through)

It 's kind of annoying though....
 
You can still send SMTP mail through your ISP, use their SMTP mail server.
I use CDO at many sites (that run Exchange) and there is never a problem going to the ISP's SMTP server.
 
Hi all;
ettienne: Our Great Corporate Firewall blocks outbound SMTP traffic. Plus, even if it didn't, the mail has to come from my Exchange account.

JerryKlmns: I kinda considered that. The downside is it ties up my station for a while, as right now with ClickYes I can keep mucking around on the net while it runs. But good call, it is faster :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top