Outlook File Attachment Based on Contact Name

Status
Not open for further replies.
D

Dan

I'm an Access developer and have limited experience with Outlook development, so hoping someone can help here.

I'll Try to explain this as best as I can. When the client selects a a contact to send a message to, I need all information pertaining to that client to be displayed in the e-mail or as a file attachment. The information will come from an outside file that will be generated from a database.

I thought of a few possible ways of doing this but I'm really not to familiar with Outlook, so if anyone has better suggestions, I'd love to hear them.

First I thought if I generated a separate file for each contact and then within Outlook VBA, code could be written to get the current contact that the e-mail is being sent to and attach the file that has the same name.

My other thought was if I was to create a form and have those form fields tied to a data source such as Excel or a text file and some type of SQL statement could be written where it would look for the matching contact in the file and populate the fields with the corresponding data. I don't even know if this would be possible.

If anyone can offer me some suggestions on this, I would really appreciate it. I'm sort've out of my comfort zone with this but I look at it as new learning experience, which is always good. Thanks. .
 
If this is a solution that you plan to deploy then using Outlook VBA is not

suitable. Outlook VBA is intended mostly for prototyping or personal code,

not deployment.

The first question I'd ask are where will this code run? Will it be in

Outlook, in Access, as standalone code, etc.? I'd also ask what Outlook

versions you intend to support, what will trigger the code to start working

and what languages you are familiar with.

You mention a client selecting a contact to send a message to. Is this in

Outlook? Is the message always open already or do you have to create it?

What about other ways of sending to a contact such as selecting one and

clicking something like a New Message to Contact button?

If the code is running in Outlook then I'd advise using a COM addin.

However, the project requirements and operation really need to be much more

clearly defined before specific architectural advise can be provided.

For general Outlook programming information that might give you some ideas

you can look at www.outlookcode.com

"Dan" <danthafdelin[at]gmail[dot]com> wrote in message

news:O8krDf8cKHA.1064@TK2MSFTNGP04.phx.gbl...
> I'm an Access developer and have limited experience with Outlook
> development, so hoping someone can help here.

> I'll Try to explain this as best as I can. When the client selects a a
> contact to send a message to, I need all information pertaining to that
> client to be displayed in the e-mail or as a file attachment. The
> information will come from an outside file that will be generated from a
> database.
> I thought of a few possible ways of doing this but I'm really not to
> familiar with Outlook, so if anyone has better suggestions, I'd love to
> hear them.

> First I thought if I generated a separate file for each contact and then
> within Outlook VBA, code could be written to get the current contact that
> the e-mail is being sent to and attach the file that has the same name.

> My other thought was if I was to create a form and have those form fields
> tied to a data source such as Excel or a text file and some type of SQL
> statement could be written where it would look for the matching contact in
> the file and populate the fields with the corresponding data. I don't even
> know if this would be possible.

> If anyone can offer me some suggestions on this, I would really appreciate
> it. I'm sort've out of my comfort zone with this but I look at it as new
> learning experience, which is always good. Thanks. . Submitted using
> https://forums.slipstick.com
 
Thanks for the reply. This would all need to be performed through Outlook. The files would be generated by the database but that's pretty much the only area that Access would play a part. I would need it be setup, so when they hit send it would trigger everything or even if I could create a button that would work just as well.

This would be done in Outlook 2007. The user also has business contact manager, so I don't know if that makes anything easier.

Basic sequence of events would be this.

1. User creates an e-mail.

2. A contact is selected.

3. E-Mail is sent with corresponding file attachment or information in the message.

If the event could even be triggered when the contact would be selected that would work just as well.

I am familiar with VBA but as I'm sure you know VBA differs between the Office applications. Same basic syntax but you have objects and such that are specific to each app. Any suggestions?

kenslovak wrote on Thu, 03 December 2009 09:37
> If this is a solution that you plan to deploy then using Outlook VBA is not
> suitable. Outlook VBA is intended mostly for prototyping or personal code,
> not deployment.

> The first question I'd ask are where will this code run? Will it be in
> Outlook, in Access, as standalone code, etc.? I'd also ask what Outlook
> versions you intend to support, what will trigger the code to start working
> and what languages you are familiar with.

> You mention a client selecting a contact to send a message to. Is this in
> Outlook? Is the message always open already or do you have to create it?
> What about other ways of sending to a contact such as selecting one and
> clicking something like a New Message to Contact button?

> If the code is running in Outlook then I'd advise using a COM addin.
> However, the project requirements and operation really need to be much more
> clearly defined before specific architectural advise can be provided.

> For general Outlook programming information that might give you some ideas
> you can look at www.outlookcode.com

> >

>

> "Dan" <danthafdelin[at]gmail[dot]com> wrote in message
> news:O8krDf8cKHA.1064@TK2MSFTNGP04.phx.gbl...
> > I'm an Access developer and have limited experience with Outlook
> > development, so hoping someone can help here.
> > I'll Try to explain this as best as I can. When the client selects a a
> > contact to send a message to, I need all information pertaining to that
> > client to be displayed in the e-mail or as a file attachment. The
> > information will come from an outside file that will be generated from a
> > database.
> > I thought of a few possible ways of doing this but I'm really not to
> > familiar with Outlook, so if anyone has better suggestions, I'd love to
> > hear them.
> > First I thought if I generated a separate file for each contact and then
> > within Outlook VBA, code could be written to get the current contact that
> > the e-mail is being sent to and attach the file that has the same name.
> > My other thought was if I was to create a form and have those form fields
> > tied to a data source such as Excel or a text file and some type of SQL
> > statement could be written where it would look for the matching contact in
> > the file and populate the fields with the corresponding data. I don't even
> > know if this would be possible.
> > If anyone can offer me some suggestions on this, I would really appreciate
> > it. I'm sort've out of my comfort zone with this but I look at it as new
> > learning experience, which is always good. Thanks. . Submitted using
> > https://forums.slipstick.com
 
Based on your requirements I'd recommend using a COM addin and handling the

Application_ItemSend event. If you aren't deploying the code to anyone else

then you can use that event from VBA code. That event can be used to get all

the recipients of the message and to add attachments or to modify the email

body with whatever information you need.

As before, I'd suggest searching at www.outlookcode.com for code to get you

started. There are many examples of ItemSend handlers there in various

languages.

"Dan" <danthafdelin[at]gmail[dot]com> wrote in message

news:OhL7FpDdKHA.1640@TK2MSFTNGP06.phx.gbl...
> Thanks for the reply. This would all need to be performed through Outlook.
> The files would be generated by the database but that's pretty much the
> only area that Access would play a part. I would need it be setup, so when
> they hit send it would trigger everything or even if I could create a
> button that would work just as well.

> This would be done in Outlook 2007. The user also has business contact
> manager, so I don't know if that makes anything easier.
> Basic sequence of events would be this.

> 1. User creates an e-mail.
> 2. A contact is selected.
> 3. E-Mail is sent with corresponding file attachment or information in the
> message.

> If the event could even be triggered when the contact would be selected
> that would work just as well.

> I am familiar with VBA but as I'm sure you know VBA differs between the
> Office applications. Same basic syntax but you have objects and such that
> are specific to each app. Any suggestions?
 
Thanks. It is going to be deployed. What type of COM add-in would I need and where would I get it? I'll be honest, I'm pretty much clueless on how to do this. Any suggestions on what I should search for on the site that you suggested? I really do appreciate all your help with this.

kenslovak wrote on Thu, 03 December 2009 12:56
> Based on your requirements I'd recommend using a COM addin and handling the
> Application_ItemSend event. If you aren't deploying the code to anyone else
> then you can use that event from VBA code. That event can be used to get all
> the recipients of the message and to add attachments or to modify the email
> body with whatever information you need.

> As before, I'd suggest searching at www.outlookcode.com for code to get you
> started. There are many examples of ItemSend handlers there in various
> languages.

> >

>

> "Dan" <danthafdelin[at]gmail[dot]com> wrote in message
> news:OhL7FpDdKHA.1640@TK2MSFTNGP06.phx.gbl...
> > Thanks for the reply. This would all need to be performed through Outlook.
> > The files would be generated by the database but that's pretty much the
> > only area that Access would play a part. I would need it be setup, so when
> > they hit send it would trigger everything or even if I could create a
> > button that would work just as well.
> > This would be done in Outlook 2007. The user also has business contact
> > manager, so I don't know if that makes anything easier.
> > Basic sequence of events would be this.
> > 1. User creates an e-mail.
> > 2. A contact is selected.
> > 3. E-Mail is sent with corresponding file attachment or information in the
> > message.
> > If the event could even be triggered when the contact would be selected
> > that would work just as well.
> > I am familiar with VBA but as I'm sure you know VBA differs between the
> > Office applications. Same basic syntax but you have objects and such that
> > are specific to each app. Any suggestions?
 
You don't get a COM addin, you develop it. It can be done using VB.NET, C#,

VB6, Delphi and various other languages. If you aren't familiar with any of

the languages like that and don't have access to some version of Visual

Studio or other development platform you might consider hiring someone to

write the code for you.

As I said, search on that Web site for information on ItemSend. You can also

look at the information there on COM addins.

"Dan" <danthafdelin[at]gmail[dot]com> wrote in message

news:uFnPTrEdKHA.4708@TK2MSFTNGP02.phx.gbl...
> Thanks. It is going to be deployed. What type of COM add-in would I need
> and where would I get it? I'll be honest, I'm pretty much clueless on how
> to do this. Any suggestions on what I should search for on the site that
> you suggested? I really do appreciate all your help with this.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Outlook Randomly Not attaching (attachment file) Using Outlook 0
RalphG101 No indication of attachment, when selecting file, send to outlook. Using Outlook 0
? outlook attachment Extract File ??? Outlook VBA and Custom Forms 1
3 Outlook 2007 and file attachment conversion Outlook VBA and Custom Forms 3
C Advanced search terms for "Outlook Data File" Using Outlook 1
G Save emails as msg file from Outlook Web AddIn (Office JS) Outlook VBA and Custom Forms 0
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
L Restoring Outlook from backup pst file Using Outlook 5
W Transfer Outlook 2016 autocomplete file to Outlook 2007 Using Outlook 1
B vBA for exporting excel file from outlook 2016 Outlook VBA and Custom Forms 3
D Outlook 2016 Unable to load Outlook data pst file Using Outlook 5
P Outlook pst file is too huge with POP3. How to save more space? Using Outlook 4
B Outlook 2013 erratically deleting original file that is attached Using Outlook 0
I Outlook 365 - import/attach PST file that used POP3 Using Outlook.com accounts in Outlook 0
J Outlook 2010 Changing events in Outlook calendar via opening file, importing CSV Using Outlook 0
L Outlook Office 365 client: won't remember my setting File, not to collapse ribbon Using Outlook 2
B Outlook 2010 Can not find a certain file in M/S Outlook 2010. Using Outlook 1
J How to open OST file in Outlook 2019 & 2016 Using Outlook 1
L What are the risks of opening an Outlook 2016 .pst file in Outlook 2010? Using Outlook 4
S auto-mapping mailboxes in outlook impacting an ost file? Exchange Server Administration 2
DariTrevino MIcrosoft Outlook PST file cannot repair Using Outlook 1
R Copy Outlook Public Folders to a File Server Shared Folder Using Outlook 0
P Outlook 2013 opens with FILE tab selected. Using Outlook 3
R How To Repair OST File & Export OST File to Outlook PST ? Using Outlook 3
J OUTLOOK 2016 FILE STORAGE WHERE COMMAND Using Outlook 12
R Sending emails via Outlook XP, from Windows 10 File Explorer Using Outlook 1
J Outlook 2016 - use of old PST file - will all emails be downloaded or only latest?? Using Outlook 1
K How to access emails found to be located in "Top of Outlook data file"? Using Outlook 3
S Outlook does not open the .pst file created by the Outlook Using Outlook 5
C out of space in file group Outlook 2007 Using Outlook 2
DAVID A moved the Outlook CST file - All subfolders lost Using Outlook 2
Diane Poremsky How to Compact the Data File When you Close Outlook Using Outlook 0
Gunny NFOhiway Outlook PST file and Rules Using Outlook 1
P Macro to attach a file in a shared Outlook draft folder Outlook VBA and Custom Forms 2
Diane Poremsky Outlook VBA: Use a Text File to Populate a ListBox Using Outlook 0
chai1949 pst file in outlook 2016 Using Outlook 3
R Macro to check file name with outlook address book Outlook VBA and Custom Forms 0
T Outlook 2016 mp3 attach "this file cannot be preview because there is no previewer installed for it" Using Outlook 1
Diane Poremsky Repair a Large Outlook Personal Folders File (over 2GB) Using Outlook 0
S Outlook 2003 to Outlook 2013 pst file Using Outlook 5
S Outlook data file cannot be accessed message Using Outlook 5
L outlook data file confusion Using Outlook 1
J Outlook Macro to Update Sharepoint Excel File Using Outlook 1
Diane Poremsky Remove a password from an Outlook *.pst File Using Outlook 3
Q Editing an outlook. Template file (Otk) Using Outlook 1
J Outlook 2013 how to convert 2013 OST file into an another format, i m using outlook 2013 versions. Using Outlook 1
O Missing guide "Move an Outlook Personal Folders .pst File" Using Outlook 4
B How to recover deleted MS Outlook OST file? Using Outlook 4
U .pst file error at opening outlook Using Outlook 1
Diane Poremsky How to repair a damaged Outlook Personal Folders file (pst) Using Outlook 0

Similar threads

Back
Top