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
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
Welcome to VBAX. I think you're looking for the MessageText parameter of the SendObject Method. http://msdn.microsoft.com/library/de...HV05186513.asp
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??
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.
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
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?
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.
The invoice can also be in an attachment but it must be in the body.Originally Posted by xCav8r
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
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.Originally Posted by Jeff B
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!!!!
Hi Jeff,Originally Posted by Jeff B
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)
If so...pm Jake and he'll add it!Originally Posted by xCav8r
_________
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)
Moose, have you code to stick rich text into the body of an outlook message?
Not on the shelf but its doable for sure!Originally Posted by xCav8r
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)
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-
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'
Hi And welcome to VBAX!
If the emailbody requires formatting like RTF or HTML then I agree you should use the "HtmlBody" property of the item.Originally Posted by jadedata
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)
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!!!
Very cool. Welcome, Jack. Your expertise would be a welcome addition to VBAX. I hope you find a home here.Originally Posted by mdmackillop
Glad to see you've found a entry to your sollution.Originally Posted by Jeff B
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)
I did. We now have a flag for Ontario.Originally Posted by MOS MASTER