Outlook with an attachment

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have code that uses SendObject to load Outlook, insert the subject and
address line. What I need to do is keep track of any attachments that are
sent. All I need is the name and path of the attachment.

Is there any way to retrieve the info so I can put it in a table?

Thanks
 
Can I see the code. I had an earlier post and was told to use the code on
the below website because sendobject does not give you an opportunity assign
an attachment it simply attaches whatever you are sending.
http://www.granite.ab.ca/access/email/outlook.htm and
http://support.microsoft.com/?kbid=161088

Anyway the code from the microsoft site worked for me. This way you can
assign the attachment.

I would create a separate table with the info you want to store the filename
and recipient as well as the date sent then I would use a query to append
the table with the information. It depends a lot on how you decided to
capture the data. You can make the email address come from code or from a
form you have popup asking the person to complete the email address and
attachment info. Hope this helps a little.

Matt
 
Matt:

This is the code I use to open and send the info to Outlook. It sets the
value of fields of a table with the information I need to save...except the
attachment name. I will try the site you suggested and let you know the
results.

Thanks,

Mike

Private Sub CreateEmail_Click()
Dim strAddress, strSubject

strAddress = DLookup("value", "comm_tbl", "clientid =
forms!client_information_frm!socialsecurityno and type = 4")
strSubject = InputBox("Enter text for subject line", "Email Data")
DoCmd.OpenForm "activities_subfrm", acNormal, , , acFormAdd, acHidden
Forms!Activities_subfrm!socSecurityNo =
Forms!client_information_frm!socialsecurityno
Forms!Activities_subfrm!ActType = 6
Forms!Activities_subfrm!Description = strSubject
Forms!Activities_subfrm!DateContacted = Date
Forms!Activities_subfrm!Contact = strAddress
DoCmd.Close acForm, "Activities_subfrm"
DoCmd.Requery



DoCmd.SendObject acSendNoObject, To:=strAddress, _
Subject:=strSubject, MessageText:="", EditMessage:=True



End Sub
 
I see what the problem is you are using sendobject which will send a query,
report table or form results in an email. It creates an attachment on the
fly. If you want to attach a file you need to use the code provided on the
links I previously gave. You have to output the file to a place and then
call the file in the sendmessage script. by calling this file you then have
a file to reference for the attachement.

Matthew
 
Back
Top