E Mail using a hyperlink address

monplankton

Registered User.
Local time
Today, 20:32
Joined
Sep 14, 2011
Messages
83
Hi everyone, I'm trying to send an attachments out to an E mail address thats selected by the person using the database selecting a customer on a dropdown cbo. What I was thinking, if I hyperlink the address on the form I could attach this to the mail, is this possible and if so how?

Thanks for your help. I'm using office 2003
 
No hyperlink necessary, you can simply refer to the control containing the address in whatever email method you've chosen. Presuming the code is in the same form:

Me.EmailAddress

where EmailAddress is the name of the control containing it.
 
Problem I have it's a different attachment for each customer held at a server address
 
If the path is on the form you can use it. If not, but it follows a pattern that can be derived using something like the customer number off the form, it's still doable. Maybe you can be more specific with the question?
 
Paul, Thanks for your help. The form is completing a document which I'm sending to a fixed E mail address written in to the code. What I'm wanting to do is attach a word document thats unique for each customer to the mail. Customer is selected from the form and designates the word document, thats why I thought of the hyperlink.
 
I'm not sure you can use a hyperlink to attach a file, though it wouldn't be the first time I was wrong. You can use automation to create the email:

http://support.microsoft.com/?kbid=161088

And get the path for the attachment off the form (or derive it from the customer).
 
PAul,

This is the code so far
Code:
Dim objOutlook As Outlook.Application, objMailItem As MailItem
  Set objOutlook = New Outlook.Application
  Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
    .To = "[EMAIL="graham.atkins@nissan-nmuk.co.uk"]graham.atkins@nissan-nmuk.co.uk[/EMAIL]"
    .CC = "[EMAIL="graham.atkins@nissan-nmuk.co.uk"]graham.atkins@nissan-nmuk.co.uk[/EMAIL]"
    .Subject = "Transport Request form"
    .Body = "Please see attached transport request form"
    '.Attachments.Add "Q:\Claire.Alderson\Supplier Quality Contact Master.xls"
    .Send
 End With
 
 
  Set objMailItem = Nothing
Set objOutlook = Nothing

Where I have "Q:\Claire.Alderson...... is where I was going to put the hyper link control!!!!
 
Again, I don't think you need a hyperlink. You would simply refer to the textbox containing the path:

.Attachments.Add Me.Whatever

where Whatever was the name of the textbox.
 
Out of time now but I'll give it a go on Monday, Thanks for your help.
 
No problem. Post back if you get stuck.
 
Paul, Tried everything I can think of but it just keeps erroring : Run-Time error object doesn't support the object or method. I've copied the form and table examples to a database so you can have a look.

This is only the first step of my problem as I want to send an attachment like this but I also want to send a report from access in the same mail. Is this possible?

Thanks for your help.
 

Attachments

You're trying to attach whatever is in textbox Text50, which is empty. You'd have to refer to the textbox containing the path. You can attach multiple items with this method, but you would need to output the report to a file (OutputTo) and then attach it.
 
OK I' understand the output of file then attach but I've populated the text50 box and it still gives the same error.
 
If you put a path into the text box located on your computer and try it you'll see what I mean.
 
Well, you didn't follow the method, plus I think it works better with a variable. This works:

Code:
  Dim objOutlook As Outlook.Application, objMailItem As MailItem
  Dim objOutlookAttach   As Outlook.Attachment  'added by Paul
  Dim strAttach          As String

  Set objOutlook = New Outlook.Application
  Set objMailItem = objOutlook.CreateItem(olMailItem)
  strAttach = "C:\BlueCrew\NevChrome.jpg"

  With objMailItem
    .To = "graham.atkins@nissan-nmuk.co.uk"
    .CC = "graham.atkins@nissan-nmuk.co.uk"
    .Subject = "Transport Request form"
    .Body = "Please see attached transport request form"
    Set objOutlookAttach = .Attachments.Add(strAttach)
    .Display
  End With


  Set objMailItem = Nothing
  Set objOutlook = Nothing
 
Paul, This is fixing the variable (Same file going to each supplier). What I'm trying to do is use the table Supplier information to store the path of a document that changes for each supplier. I've added another supplier. path is seen in Text50. Sorry if I'm not explaining myself very well but it the fact the document path is differnt depending on the supplier selected. Update database attached.
 

Attachments

I'm not following! Looking at you code it will always select "C\BlueCrew etc etc...
What I'm trying to do is change the path dependant on the select supplier. The path in Text50 changes so the VBA needs to reference the Textbox or as I started out hyperlink, both on the form for reference. This is what I have so far and I've updated the mini database with it...............Still not working.
Code:
 DoCmd.OutputTo acReport, "rpt_TRF", "SnapshotFormat(*.snp)", "D:\TRF.snp", False, "", 0
    Dim objOutlook As Outlook.Application, objMailItem As MailItem
  Set objOutlook = New Outlook.Application
  Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
    .To = "[EMAIL="graham.atkins@nissan-nmuk.co.uk"]graham.atkins@nissan-nmuk.co.uk[/EMAIL]"
    .CC = "[EMAIL="graham.atkins@nissan-nmuk.co.uk"]graham.atkins@nissan-nmuk.co.uk[/EMAIL]"
    .Subject = "Transport Request form"
    .Body = "Please see attached transport request form"
    Set objOutlookAttach = .Attachments.Add(Me.Text50)
    
    .Send
 End With
 
  Set objMailItem = Nothing
Set objOutlook = Nothing

Sorry for being a pain

Graham :confused:
 

Attachments

Put the path into a variable.
 
Definately lost me now. Don't know what do you mean can you explain or show me?
 
Did you look at the code I posted? Use your value instead of the hard-coded value I used.
 

Users who are viewing this thread

Back
Top Bottom