PDA

View Full Version : VBA from Excel to Outlook 2010 help



Zanatos666
09-27-2012, 11:35 AM
Hello,

Im new, so please, bare with me if I do this incorrect (which I am sure I will).

So, I have an old VBA Excel macro that someone created for me years ago, back when actually using Office XP. The code has endured over the years, for the most part. Only part I have had to change has been cosmetic stuff like a progress bar.

So, its basically an Excel macro that looks for a criteria in one spreadsheet, finds an email address in another spreadsheet, creates a workbook, references another spreadsheet to find an email address based on another set of criteria, opens an email in Outlook, attaches that workbook, and sends it out.

Watching it run, it is creating the spreadsheet, finding the email address, but when it goes to call Outlook to create the email, thats where its stopping. Specifically, at this line.

blnSuccessful = objOutlook.FnSendMailSafe("(I omitted the email address here)", _
"", _
"", _
Vendor & " - " & Left(emailSubject, Len(emailSubject) - 2), _
"Hello " & vendorData(vendorPlace).Contact & emailBody & signature, _
UserForm1.CheckBox14.Value, _
CDate(UserForm1.TextBox38.Text), _
vendorFile)

Anyone have any clue as to what needs to be changed here?

Kenneth Hobs
09-28-2012, 05:50 AM
Welcome to the forum!

If you are using that for MSOutlook 2010, it will not work. See the note at http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-Without-Security-Warning.

CDO is probably the better way to go if you want to bypass security popups. http://www.rondebruin.nl/cdo.htm

Zanatos666
09-28-2012, 02:23 PM
Thanks. I was able to get the CDO working with Outlook and Excel. Now, the fun part (since I didnt code this and my knowledge is limited at best), trying to figure out how to strip out the blnsuccessful out of the original code and insert this and have it all work.