ms access 2007 - macro to email Accces reports not as an attachment -
I do not know VBA, for me there is a way to send emails to macros where the report will be in the body of the email and the attachment not as as? I currently use the "send-object" command and send it in HTML format, please advise. Thank you very much
If you are using Outlook, you can write a report or query on the disk Can and use either HTMLBody or RTFBody, this is a time since I have tested it, I hope it is still useful.
Const ForReading = 1, ForWriting = 2, ForAppending = 3 Dim FS, F DIM RTFBDI Slight MyApp New Outlook.Application Dust MyItem Outlook.MailItem DoCmd.OutputTo acOutputReport, "Report 1", acFormatRTF , "Report1.rtf", "DoCmd.OutputTo acOutputQuery," QUERY1 ", acFormatHTML," Query1.htm "set as FS = CreateObject (" Scripting.FileSystemObject ") f = fs.OpenTextFile (" Report1 .rtf ", ForReading) '' f = fs.OpenTextFile set (" Query1.htm ", ForReading) RTFBody = f.ReadAll '' Debug.Print RTFBody f.Close set MyItem = MyApp.CreateItem (olMailItem) MyItem.Action = "Abc@def.ghi" .seubject = "theme" .RTFBody = RTFBody '' .HTMLBody = RTFBody end with MyItem.Display
Comments
Post a Comment