![]() |
Attachment present, but not showing.
I'm revisiting an issue that I had in January. At the time Sue
suggested a possible solution, but either I wasn't sure how to implement it, or it wasn't working (most probably #1). I am trying to send email with an attached file from Access. I have a command button that creates a CSV file, which should then be attached to an email. The email should open for the sender to review before actually sending. The code works, except that when the outlook message is opened, the Attachment field doesn't show. When email is sent, the file *is* attached. Here's the code used to actually send the file (note, not mine, scavenged from elsewhere). === Dim safemail As Variant Dim myOlApp Dim MyItem Dim myRecipient Dim myBody Dim myfolder Dim mynamespace Dim myAttachments Dim Utils Dim strSendTo As String strSendTo = " Set myOlApp = CreateObject("Outlook.Application") Set MyItem = myOlApp.CreateItem(0) Set safemail = CreateObject("Redemption.SafeMailItem") Set safemail.Item = MyItem Set mynamespace = myOlApp.GetNamespace("MAPI") Set myfolder = mynamespace.GetDefaultFolder(5) With safemail .To = strSendTo .Attachments.Add (strCSVExport) ' Attachment 1 .Subject = "New CFCW Applications - " & Date ' Email Subject Text here .Body = "Latest batch of CFCW applications" ' Text for Email Body .Display End With Set Utils = CreateObject("Redemption.MAPIUtils") Utils.DeliverNow Set myOlApp = Nothing Set safemail = Nothing Set Utils = Nothing === Sue had suggested that maybe to show the attachment it needed to be saved first, and pointed out that I should use .Save for that. Alas, not sure where that statement would go, I tried in many places, no effect. :( Any ideas on how to get the actual attachment to appear in the attachment field in the message before sending it? thanks |
Attachment present, but not showing.
Nothing in your code to create the new message requires Redemption. You can simplify it to:
strSendTo = " Const olFormatPlain = 1 Set myOlApp = CreateObject("Outlook.Application") Set MyItem = myOlApp.CreateItem(0) With MyItem ' use next statement only in Outlook 2002 or later .BodyFormat = olFormatPlain .To = strSendTo .Attachments.Add (strCSVExport) ' Attachment 1 .Subject = "New CFCW Applications - " & Date ' Email Subject Text here .Body = "Latest batch of CFCW applications" ' Text for Email Body .Display End With -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx wrote in message ps.com... I'm revisiting an issue that I had in January. At the time Sue suggested a possible solution, but either I wasn't sure how to implement it, or it wasn't working (most probably #1). I am trying to send email with an attached file from Access. I have a command button that creates a CSV file, which should then be attached to an email. The email should open for the sender to review before actually sending. The code works, except that when the outlook message is opened, the Attachment field doesn't show. When email is sent, the file *is* attached. Here's the code used to actually send the file (note, not mine, scavenged from elsewhere). === Dim safemail As Variant Dim myOlApp Dim MyItem Dim myRecipient Dim myBody Dim myfolder Dim mynamespace Dim myAttachments Dim Utils Dim strSendTo As String strSendTo = " Set myOlApp = CreateObject("Outlook.Application") Set MyItem = myOlApp.CreateItem(0) Set safemail = CreateObject("Redemption.SafeMailItem") Set safemail.Item = MyItem Set mynamespace = myOlApp.GetNamespace("MAPI") Set myfolder = mynamespace.GetDefaultFolder(5) With safemail .To = strSendTo .Attachments.Add (strCSVExport) ' Attachment 1 .Subject = "New CFCW Applications - " & Date ' Email Subject Text here .Body = "Latest batch of CFCW applications" ' Text for Email Body .Display End With Set Utils = CreateObject("Redemption.MAPIUtils") Utils.DeliverNow Set myOlApp = Nothing Set safemail = Nothing Set Utils = Nothing === Sue had suggested that maybe to show the attachment it needed to be saved first, and pointed out that I should use .Save for that. Alas, not sure where that statement would go, I tried in many places, no effect. :( Any ideas on how to get the actual attachment to appear in the attachment field in the message before sending it? thanks |
Attachment present, but not showing.
Sue to the rescue! Thanks, it worked.
I knew I didn't need redemption, I didn't know how to get rid of it. |
All times are GMT +1. The time now is 10:32 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com