Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 24

Thread: How to email a rtf file as the body of an email

  1. #1
    VBAX Regular
    Joined
    Aug 2005
    Posts
    7
    Location

    Question How to email a rtf file as the body of an email

    From within Access (2003), using VBA, I've opened a RTF file, and changed it. Now I need to send it as the BODY of an email. Can't seem to figure this out. Any ideas?
    Thanks,
    Jeff B

  2. #2
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location


    Welcome to VBAX. I think you're looking for the MessageText parameter of the SendObject Method. http://msdn.microsoft.com/library/de...HV05186513.asp


  3. #3
    VBAX Regular
    Joined
    Aug 2005
    Posts
    7
    Location
    Not sure I follow you, the MessageText parameter allows me to insert plain text in the body, not RTF. It seems the SENDOBJECT only allows me to send one of the objects (see below) as an ATTACHMENT, and only allows PLAIN TEXT in the body.
    The sendobject has these parameters:
    expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc, Subject, MessageText, EditMessage, TemplateFile)

    where ObjectType can be one of
    acSendDataAccessPane acSendForm acSendModule acSendNoObject default acSendQuery acSendReport acSendTable Perhaps I'm not understaning this SENDOBJECT correctly??

  4. #4
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    I didn't pay close enough attention to RTF. Just thought you wanted to know how to put text into the body of an email. Sorry about that. Anyway, AFAIK, what you want to do can't be done with Access. You'll need to do that in Word or Outlook.

    One of our users posted this in a recent thread. You could use this code to send the RTF as an attachement.

    http://www.vbaexpress.com/forum/showthread.php?t=4358

    In the meantime, I wrote one of the other moderators to see which forum would be the most appropriate one for this question. I'll move the thread to Word or Outlook when I get some feedback from him.

  5. #5
    VBAX Regular
    Joined
    Aug 2005
    Posts
    7
    Location

    one other thing

    Thank you for your response. Yes, this is a bit tricky. From within Access (2003) I'm composing invoices by inputting data from the database into a RTF template file. Then while still in Access I need to insert the completed RTF invoice into the body of the Email, and send it (I'll be satisfied to at least put them in the OUT box). There are at least 100 invoices each time, so I can't afford to deal with any security warnings etc.

    I see it can be done manually from inside WORD, that is you can send any document as the body of an email. When I looked at the sent email it appeared that the message body had been formatted to HTML (XML?).
    Perhaps XML is involved in this somehow.

    Thank you for your assistance, very much appreciated (this is driving me crazy)!
    Last edited by Jeff B; 08-06-2005 at 10:31 PM. Reason: forgot something

  6. #6
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    It's not okay then to use the rtf as an attachment? It's gotta be in the body of the email? And, you didn't say. Do you have both Word and Outlook?

    P.S. Is it not possible to select a CA province for a flag?

  7. #7
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Why not use Mail Merge in Word with Access as the data source?

    Or you could write code that plugs the data into an existing Word template using bookmarks.

    I know this is possible as I've done it myself. I'll have a look and see if I can dig out the code.

  8. #8
    VBAX Regular
    Joined
    Aug 2005
    Posts
    7
    Location

    Clarification

    Quote Originally Posted by xCav8r
    It's not okay then to use the rtf as an attachment? It's gotta be in the body of the email? And, you didn't say. Do you have both Word and Outlook?

    P.S. Is it not possible to select a CA province for a flag?
    The invoice can also be in an attachment but it must be in the body.
    I have the complete Office 2003 Pro.
    I should clarify, I need to do the automation from within Access (using VBA).

    Now I'm wondering if I could create a template invoice email in Outlook, and then use VBA from within Access to access it and insert the individual data.

    (Can't select Ontario - doesn't offer that choice)
    Last edited by Jeff B; 08-07-2005 at 11:03 PM. Reason: Clarification

  9. #9
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Quote Originally Posted by Jeff B
    The invoice can also be in an attachment but it must be in the body.
    I have the complete Office 2003 Pro.
    I should clarify, I need to do the automation from within Access (using VBA).

    Now I'm wondering if I could create a template invoice email in Outlook, and then use VBA from within Access to access it and insert the individual data.

    (Can't select Ontario - doesn't offer that choice)
    I understand that you need to do the automation within Access, but it could be done from any Office application, and I think you might get more exposure with people who know how to automate Outlook in the Outlook forum, but we'll leave it here for the time being with the hope that they'll come read and offer solutions.

    I made another attempt to contact my friend, Moose, who I'm sure will be able to help. Let's see if my second PM gets more traction than the first.

    No Ontario? Argh!!!!

  10. #10
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by Jeff B
    There are at least 100 invoices each time, so I can't afford to deal with any security warnings etc.
    Hi Jeff,

    Well that's a problem indeed!

    Outlooks security cannot be turned off! However there are ways to bypass the security and so you can utilize Mark's code in the link thread.

    But all the good ones involve installing a DLL or a program to your computer to help you tackle that Outlook security.

    All possible options are listed here:
    http://www.outlookcode.com/d/sec.htm

    We need to find out first if you're able to install for instance Outlook Redemption DLL to fix this problem.

    So are you allowed to do that?
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  11. #11
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by xCav8r
    No Ontario? Argh!!!!
    If so...pm Jake and he'll add it!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  12. #12
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Moose, have you code to stick rich text into the body of an outlook message?

  13. #13
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by xCav8r
    Moose, have you code to stick rich text into the body of an outlook message?
    Not on the shelf but its doable for sure!

    But for me the big question here is if he can utilize Redemption or a other tool to bypass the security.

    If not then he'll better stick to mailing as attachment with SendObject method!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  14. #14
    VBAX Regular jadedata's Avatar
    Joined
    May 2004
    Location
    Eastport, Maine
    Posts
    13
    Location
    You can not use the RTF itself as the email body. You could only use the content from the rtf.

    The best way I can recomment to do this is using HTML content for the email body.

    -j-
    -j-

  15. #15
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Jack,
    Welcome to VBA Express.
    It's great to see another real Access expert joining us.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  16. #16
    Administrator
    VP-Knowledge Base VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Hi And welcome to VBAX!

    Quote Originally Posted by jadedata
    The best way I can recomment to do this is using HTML content for the email body.
    If the emailbody requires formatting like RTF or HTML then I agree you should use the "HtmlBody" property of the item.

    To retrieve the HTML you'd best save the RTF file as (*htm or *html) and then use FileSystemObject to read it as text to pass to the HtmlBody.

    But for me the biggest issue here is the security problem. This always provides the biggest challenge in Outlook.

    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  17. #17
    VBAX Regular
    Joined
    Aug 2005
    Posts
    7
    Location
    Wow... many opportunities here. THANKS!
    Right now I have had to move on to other things and will get back to trying some of the suggestions ASAP. For now it will have to be an attachment. Thanks for your wonderful assistance!!!

  18. #18
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Quote Originally Posted by mdmackillop
    Hi Jack,
    Welcome to VBA Express.
    It's great to see another real Access expert joining us.
    Regards
    MD
    Very cool. Welcome, Jack. Your expertise would be a welcome addition to VBAX. I hope you find a home here.

  19. #19
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by Jeff B
    Wow... many opportunities here. THANKS!
    Right now I have had to move on to other things and will get back to trying some of the suggestions ASAP. For now it will have to be an attachment. Thanks for your wonderful assistance!!!
    Glad to see you've found a entry to your sollution.

    Keep us posted!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  20. #20
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Quote Originally Posted by MOS MASTER
    If so...pm Jake and he'll add it!
    I did. We now have a flag for Ontario.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •