A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Attachment present, but not showing.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 18th 06, 05:48 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 5
Default 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

Ads
  #2  
Old July 18th 06, 12:10 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default 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

  #3  
Old July 18th 06, 10:11 PM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 5
Default 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.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 05:07 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-2025 Outlook Banter.
The comments are property of their posters.