Rocky Smolin
rockysmolin at bchacc.com
Mon Dec 20 18:23:14 CST 2010
Bryan: Got an email problem maybe you can help me with. When I send to any databaseadvisors.com list from Outlook the mail gets there. When on the road I used to use Mail2Web.com and had no problem. But on the road, their response time is really slow from Mail2Web so I switched Godaddy.com's web mail because they're hosting my sites. But when I send email to any databaseadvisors.com account, from the GoDaddy webmail site the mail doesn't get there and there's no bounce back. GoDaddy sez (of course) problem is not on their side. And I think maybe not since databaseadvisors is the only domain I'm having a problem with. Any idea what could be causing this? TIA Rocky -----Original Message----- From: John Bartow [mailto:john at winhaven.net] Sent: Sunday, December 19, 2010 10:12 PM To: 'Rocky Smolin' Subject: RE: Access to Outlook VBA Hi Rocky, Thanks for the code samples and the follow ups. I finally got the email working directly through Outlook albeit with the security warning. I'm adapting some of Helen's export to Outlook code to work with this app too. I bought "Microsoft Outlook 2007 Programming" book from Amazon (Kindle version) so that I can expand my knowledge on this horrific object model even more - LOL - I'm sure this will make learning PowerPoint's Object Model seem simple. John B -----Original Message----- From: Rocky Smolin [mailto:rockysmolin at bchacc.com] Sent: Friday, December 17, 2010 9:27 AM To: 'John Bartow' Subject: RE: Access to Outlook VBA John: The simplest method is like this: ************************************************************************** If Not IsNull(fldEmail1) Then 'Call SendMessage(fldCustomerEmail1) DoCmd.SendObject acSendNoObject, , , fldEmail1 Else MsgBox "No Email Address.", vbExclamation End If Exit Sub ************************************************************************** If Outlook's the default mail client then that's where the email shows up. Just a blank email with the email address. Here's code from my customer tracking system that gets the body text from a word doc and presents it in an email. It pulls the email address from a bound text box on the calling form. This is purely Outlook. Notice that the .Send command is commented out. I like to review the email before sending: ************************************************************************** Private Sub cmdSendLetter_Click() If Nz(Me.fraWhatToSend) = 0 Then MsgBox "Selct email to send.", vbExclamation Exit Sub End If Select Case Me.fraWhatToSend Case 1 Call MakeMessage("C:\E-Z-MRP-V22\Follow Up - Recently Shipped.doc", _ "Recently Shipped E-Z-MRP Evaluation System") Case 2 Call MakeMessage("C:\E-Z-MRP-V22\Follow Up - About To Expire.doc", _ "Your E-Z-MRP Evaluation System Is About To Expire") Case 3 Call MakeMessage("C:\E-Z-MRP-V22\Follow Up - Has Expired.doc", _ "Your E-Z-MRP Evaluation System Has Expired") Case 4 Call MakeMessage("C:\E-Z-MRP-V22\E-Z-MRP Setup Intructions-yousendit.doc", _ "Your E-Z-MRP Evaluation System Setup") End Select End Sub Private Sub MakeMessage(argDocument As String, argSubject As String) 'Dim objWord As Word.Application Dim objWord As Object Dim objWordDoc As Word.Document Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment ' Get the body text Set objWord = CreateObject("Word.Application") objWord.Documents.Open (argDocument) objWord.Selection.WholeStory strBody = objWord.Selection 'MsgBox strBody objWord.Documents.Close SaveChanges:=wdDoNotSaveChanges objWord.Quit Set objWord = Nothing ' Create the Outlook session. Set objOutlook = CreateObject("Outlook.Application") ' Create the message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem) With objOutlookMsg ' Add the To recipient(s) to the message. 'If intRecipients > 1 Then ' For intI = 1 To intRecipients ' Set objOutlookRecip = .Recipients.Add(astrRecipients(intI)) ' objOutlookRecip.Type = olBCC ' Next intI 'Else ' Set objOutlookRecip = .Recipients.Add(astrRecipients(1)) ' objOutlookRecip.Type = olTo 'End If Set objOutlookRecip = .Recipients.Add(Me.fldEmail1) objOutlookRecip.Type = olTo ' Set the Subject, Body, and Importance of the message. .Subject = argSubject .Body = strBody '.Importance = olImportanceHigh 'High importance ' Resolve each Recipient's name. 'For Each objOutlookRecip In .Recipients objOutlookRecip.Resolve 'If Not objOutlookRecip.Resolve Then objOutlookMsg.Display 'End If 'Next '.Send End With Set objOutlookMsg = Nothing Set objOutlook = Nothing End Sub ************************************************************************** I've also got some code that pushes records from Access into an Outlook Calendar - including a routine to select the calendar to push them into - if you need something like that. Best, Rocky -----Original Message----- From: John Bartow [mailto:john at winhaven.net] Sent: Thursday, December 16, 2010 9:58 PM To: 'Rocky Smolin' Subject: Access to Outlook VBA Rocky, Thanks for all those for sending contacts to Outlook. That should help a lot. I am just about there with what I need but I'm getting an error message that says I need a VB help file. Well, I can't imagine that's actually correct. I thought maybe my system was corrupt in some way but I just ran Helens samples and hers worked so I can dig through and find the culprit now. Have you got any code that you could share for sending an email from Access to Outlook? I have to replace my really nice emailing routines that use a third party email engine over to using strictly Outlook and I'm beating my head against a wall on that. It seems like I'm downgrading my app because some IT guy wants everything "just so". John B