Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How can I alter my code to send an attachment?

Discussion in 'Information Technology' started by AbraAbraCadabra, Jul 28, 2006.

  1. AbraAbraCadabra

    AbraAbraCadabra
    Expand Collapse
    Guest

    Here is the code I am using to send mail...
    With objEmail
    .From = Chr(34) & "Name" & Chr(34) & "myemail@mydomain.com"
    .To = strToArray(x)
    .Subject = strSubject
    .HtmlBody = strBody
    .Send
    End With


    How can I send an attachment?
    Is it something like this...?
    .attachment="c:\file.txt"
     
  2. Loading...

    Similar Threads Forum Date
    Movies Alternate View - Review Of 'PROMETHEUS' Theatre, Movies & Cinema Nov 12, 2016
    Gurus Guru Gobind Singh’s Concept of Alternative Community History of Sikhism Dec 30, 2013
    Mealtime Prayer/Palki Sahib Alternatives? Questions and Answers Jul 2, 2013
    General Should Religion Be Altered with Changes in Time and Society? Hard Talk Apr 15, 2013
    Controversial The Wiles of Woman: Research and Statistics to Represent an Alternative Viewpoint Hard Talk Oct 28, 2012

  3. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    See if this recent thread helps:

    http://www.microsoft.com/office/com...cess&mid=a6cff88e-6897-46bb-b112-2d7014c31602


    Tom Wickerath, Microsoft Access MVP

    http://www.access.qbuilt.com/html/expert_contributors.html
    http://www.access.qbuilt.com/html/search.html
    __________________________________________

    "AbraAbraCadabra" wrote:

    > Here is the code I am using to send mail...
    > With objEmail
    > .From = Chr(34) & "Name" & Chr(34) & "myemail@mydomain.com"
    > .To = strToArray(x)
    > .Subject = strSubject
    > .HtmlBody = strBody
    > .Send
    > End With
    >
    >
    > How can I send an attachment?
    > Is it something like this...?
    > .attachment="c:\file.txt"
     
  4. AbraAbraCadabra

    AbraAbraCadabra
    Expand Collapse
    Guest

  5. Ron2006

    Ron2006
    Expand Collapse
    Guest

    that is if you are using the sendobject command and I am not sure that
    is what you are doing

    Have you tried adding the following to your code:

    .attachments.Add ReportDir & exportName ' point to the full
    address of attachment here
    ' There can be multiple of the above
     
  6. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    Hi AbraAbraCadabra,

    > Tom, if I read your thread correctly, it states it is not possible to send an
    > attachment using the method I am using.


    What method are you using? You only provided a code snippet. If you are
    using SendObject, I don't think that it supports HTML (ie. .HtmlBody =
    strBody), so I just assumed you were using Outlook. It is possible to attach
    an Access object (table, query, report) using SendObject, but I'm not so sure
    that this method supports attaching an external file. Check it out in the
    Help file, but I'm pretty sure that it only supports attaching an Access
    object.


    Tom Wickerath, Microsoft Access MVP

    http://www.access.qbuilt.com/html/expert_contributors.html
    http://www.access.qbuilt.com/html/search.html
    __________________________________________

    "AbraAbraCadabra" wrote:

    > Tom, if I read your thread correctly, it states it is not possible to send an
    > attachment using the method I am using. Is this correct?
    >
    > I realize I could use Outlook to send an attachment, but I was trying
    > to avoid that if possible.
     
  7. AbraAbraCadabra

    AbraAbraCadabra
    Expand Collapse
    Guest

    Here is what I am using...

    Set objEmail = CreateObject("CDO.Message")
    With objEmail
    .From = Chr(34) & "John" & Chr(34) & "myemail@mydomain.com"
    .To = "john@smithhomes.com"
    .Subject = "Test"
    .TextBody = "Test"
    .Send
    End With
    Set objEmail = Nothing
     
  8. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    I can't say that I've ever used CDO, so I'm afraid you're on your own, unless
    someone else wants to contribute to this thread. I would search the Knowledge
    Base for samples:

    http://support.microsoft.com/search...dt=0&comm=1&ast=1&ast=2&ast=3&mode=a&x=15&y=9

    and also MSDN:
    http://search.msdn.microsoft.com/search/default.aspx?siteId=0&tab=0&query=cdo

    This one looks promising:
    http://msdn.microsoft.com/library/d...1d-c2bb-41ad-8a47-15deb4dbc8a8.asp?frame=true

    Finally, if you don't have any luck there, you can always try a Google
    Groups Advanced Search.


    Good Luck,

    Tom Wickerath, Microsoft Access MVP

    http://www.access.qbuilt.com/html/expert_contributors.html
    http://www.access.qbuilt.com/html/search.html
    __________________________________________


    "AbraAbraCadabra" wrote:

    > Here is what I am using...
    >
    > Set objEmail = CreateObject("CDO.Message")
    > With objEmail
    > .From = Chr(34) & "John" & Chr(34) & "myemail@mydomain.com"
    > .To = "john@smithhomes.com"
    > .Subject = "Test"
    > .TextBody = "Test"
    > .Send
    > End With
    > Set objEmail = Nothing
    >
    >
    >
     

Share This Page