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

Outlook File Attachment Based on Contact Name



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 3rd 09, 03:22 AM posted to microsoft.public.outlook.program_vba
dan
external usenet poster
 
Posts: 6
Default Outlook File Attachment Based on Contact Name

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 http://www.outlookforums.com
Ads
  #2  
Old December 3rd 09, 02:37 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook File Attachment Based on Contact Name

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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dan" danthafdelin[at]gmail[dot]com wrote in message
...
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
http://www.outlookforums.com


  #3  
Old December 3rd 09, 05:01 PM posted to microsoft.public.outlook.program_vba
dan
external usenet poster
 
Posts: 6
Default Outlook File Attachment Based on Contact Name

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

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dan" danthafdelin[at]gmail[dot]com wrote in message
...
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
http://www.outlookforums.com


  #4  
Old December 3rd 09, 05:56 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook File Attachment Based on Contact Name

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.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Dan" danthafdelin[at]gmail[dot]com wrote in message
...
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?


 




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
Is there an Outlook contact program that is household based? Curious Sue Outlook - Using Contacts 5 May 13th 09 03:36 PM
new contact based on existing contact Bob Day Outlook - Using Contacts 3 August 11th 08 09:05 PM
Outlook contacts to web based contact group adadad Outlook - Using Contacts 1 November 28th 06 02:33 PM
Autosave attachment and create text file based on information in email. [email protected] Outlook and VBA 3 September 5th 06 05:25 AM
Can I replace the attachment file when double chick attachment? [email protected] Outlook - General Queries 3 August 3rd 06 04:10 PM


All times are GMT +1. The time now is 03:38 PM.


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.