Re: Sending Multiple Attachments from Outlook
- From: "Michael Bauer [MVP - Outlook]" <mb@xxxxxxxx>
- Date: Fri, 4 Aug 2006 18:35:50 +0200
Am Fri, 4 Aug 2006 09:17:02 -0700 schrieb Bob B.:
Yes, if the code runs within Access you need to add a ref to Outlook via
Tools/References.
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --
Michael,a
Thank you for your response, I am not sure what I am doing wrong. This
looks so simple but I am still not able to get it to work. Let me give you
little more detail about what's happening:I
I have an ACCESS application that writes files to a static directory like
mentioned before. Once the files are written, I open an e-mail with acurrently
purchase order as an attachment using the following command:
DoCmd.SendObject acSendReport, "rptMaterialPurchaseOrders-Email",
acFormatRTF, , , , "Omni Purchase Order", Chr(13) & Chr(13), , False
At this point the e-mail is open. I now manually attach 1 to 3 product
specifications before sending it to the supplier. From within the
open e-mail, I want to have a button that will add the files from thea
directory. I have the code set up to read the names of the files in the
directory and can list them one by one. I just need to figure out how to
attach them.
When I run the code you sent me, I get the following error:
Compile Error:
User-Defined Type Not Defined
and it is refering to the line:
Mail As Outlook.MailItem
Any Ideas?
Thank You again.
"Michael Bauer [MVP - Outlook]" wrote:
Am Thu, 3 Aug 2006 13:40:02 -0700 schrieb Bob B.:
A NoteItem can´t have attachments. Do you mean a MailItem?
Maybe you can extend the code that writes the files, at that point you do
know the file names and how many there´re.
Dim Mail as Outlook.MailItem
Set Mail=Application.CreateItem(olMailItem)
' Here the loop that probably write the files
for i=1 to 3
' write the file
' attach it
Mail.Attachments.Add filename
next
--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
-- www.VBOffice.net --
I have an ACCESS database that writes anywhere from 1 to 3 reports to
arestatic directory (C:\Mfg_Software\EMails\FileName.pdf). The directory is
emptied by the code prior to writing the pdf's so the only files in it
followingthe ones I want to send. What I would like to do is press a button andhave
it attach all files from that directory to my note. I found the
.example from Eric Legault from 8/23/2005 that looked like it would workbut I
can't get it to.multiple
Sub AddAttachments()
Dim objItem As Object
If ActiveExplorer.Selection.Count = 0 Then Exit Sub
For Each objItem In ActiveExplorer.Selecion
objItem.Attachments.Add ("C:\Mfg_Software\EMails\147.pdf")
objItem.Save
Next
End Sub
I am using a static file name in this example but can handle the
names through code if I can just get the Attachment to work. Can anyoneout
there give me some insight as to what I am doing wrong? I have Outlook2003
and tried using this as a macro from the Main Outlook screen as well asfrom
inside a new note.
Thank You in advance for any help you can give me.
Regards,
Bob
- Follow-Ups:
- Re: Sending Multiple Attachments from Outlook
- From: Bob B.
- Re: Sending Multiple Attachments from Outlook
- References:
- Re: Sending Multiple Attachments from Outlook
- From: Michael Bauer [MVP - Outlook]
- Re: Sending Multiple Attachments from Outlook
- From: Bob B.
- Re: Sending Multiple Attachments from Outlook
- Prev by Date: RE: Visual Basic Editor opens automatically after lock, unlock com
- Next by Date: Re: Sending Multiple Attachments from Outlook
- Previous by thread: Re: Sending Multiple Attachments from Outlook
- Next by thread: Re: Sending Multiple Attachments from Outlook
- Index(es):