![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 |
Ads |
#2
|
|||
|
|||
![]()
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 |
#3
|
|||
|
|||
![]()
Sue to the rescue! Thanks, it worked.
I knew I didn't need redemption, I didn't know how to get rid of it. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Add a User to a DL present in GAL. | K.N.Ganesh. | Outlook and VBA | 3 | May 28th 06 01:27 PM |
Incoming e-mails are showing up as an attachment also | Dazzler | Outlook - General Queries | 1 | May 2nd 06 02:19 PM |
How do I print an email showing an attachment | Rich | Outlook - Installation | 1 | February 8th 06 07:31 PM |
Context Menu not present | Mono | Outlook Express | 5 | February 7th 06 06:22 PM |
IMAP Trash Showing/Not Showing | Marc Ferguson | Outlook - General Queries | 4 | January 31st 06 05:07 PM |