UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Attach Zip File To Already Created Outlook Email, Access 2016    
 
   
aggiemarine07
post Aug 29 2019, 07:44 AM
Post#1



Posts: 88
Joined: 7-January 11



I was wondering, is it possible with VBA to have Access attach a file (in my case a zip file) to an already created outlook email (in my case the drafts folder)?

I know you can have Access generate an email from scratch and attach a file as I've seen that posted here numerous times. I dont believe I can have access auto-generate the email because it has about 183 recipients and has to be formatted with certain categories as I am copy/pasting updates that people send to me over the course of a week.
Go to the top of the page
 
DanielPineault
post Aug 29 2019, 08:25 AM
Post#2


UtterAccess VIP
Posts: 7,144
Joined: 30-June 11



See: http://www.devhut.net/2010/09/03/vba-send-...ook-automation/ , specifically the .Attachments.Add()

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
aggiemarine07
post Aug 29 2019, 08:40 AM
Post#3



Posts: 88
Joined: 7-January 11



@DanielPineault thanks for the response. I saw this among other responses but that's for creating an email from scratch (not what I want to do).

Does that code allow me to specify the email I want to add the attachment to?
Go to the top of the page
 
DanielPineault
post Aug 29 2019, 09:06 AM
Post#4


UtterAccess VIP
Posts: 7,144
Joined: 30-June 11



So you need to bind to an e-mail and then use the Attachments.Add() method.

How are you selecting the email to add the attachment to? Is this supposed to be automatic (in which case you'd need to have the e-mail's EntryId) or are you want some user interaction (ie the user selects the email)?

The following code illustrates how-to bind to an existing email, refer to https://www.devhut.net/2019/08/20/vba-retri...k-message-item/, once you've bound to it and have a valid oOutlookMsg you can use the Attachments.Add() method.

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
aggiemarine07
post Aug 29 2019, 09:55 AM
Post#5



Posts: 88
Joined: 7-January 11



That's pretty neat, I didnt know that outlook email have an EntryID and folders in outlook have a FolderID.

How do I find out what those are in outlook? Open up the email and go to properties?
Go to the top of the page
 
DanielPineault
post Aug 29 2019, 10:57 AM
Post#6


UtterAccess VIP
Posts: 7,144
Joined: 30-June 11



Everything depends on your work flow/process.

How is the Draft being created? If it is done through automation, then you can capture the EntryID at that point in time and reuse it to bind to it at a later time. If it is manually done, you need some unique identifier... to be able to filter the items to locate it. We'd need more information to better guide you.

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
aggiemarine07
post Aug 29 2019, 02:36 PM
Post#7



Posts: 88
Joined: 7-January 11



@DanielPineault Thanks so much for the education on all of this, this is literally opening up a new world to me (i.e. using VBA in outlook).

What i do each week is start with a template and then manually consolidate the information from this multitude of emails into 6 categories within the body of that email.

It would be pretty cool for outlook to create a new email from the template and then attach the zip file. In that case would I reference the EntryID from the template and tell it to create a new email?
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    25th February 2020 - 06:58 AM