[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1840
  • Last Modified:

Report PASTED into E-Mail body as RTF Version

Greetings, I have a report that I would like to paste (as an RTF format) into the body of an e-mail (NOT as an attachment, but into the body). I am not sure how I can copy the report to the clipoard, and then paste into the body all in one motion, but I am hoping someone here can!!

The best thoughts I have, would be to save the report as RTF, then open the file, read the results and copy/paste it into the body of the e-mail, but I am way out of my league to do this.

I dont have any pictures, but I am using a pretty complex report with tables built in and sub-reports being used.

Creating the RTF file works perfectly, I just need to be able to copy the same file into an e-mail body...

Thanks!


I have this:

With objMail
     .To = "Report Distro"
     .Subject = "REPORT" & Format(Date, "dd-mmm-yyyy")
     .Body = THIS IS WHERE THE REPORT NEEDS TO BE PASTED
     .Display
End With
0
NickJPhillips
Asked:
NickJPhillips
1 Solution
 
laeijeborCommented:
to save the report as a txt:

docmd.OutputTo acOutputreport, "ReportName", acFORMATtxt, "C:\Example\Report.txt"


then http://www.vbaexpress.com/kb/getarticle.php?kb_id=699#instr has this to say about reading a file. [Use LoadTextFile("C:\Example\Report.txt") after body =]  :

(add this function into your form)

Public Function LoadTextFile(sFile As String) As String
    Dim iFile As Integer
     
     ' \\ Use FreeFile to supply a file number that is not already in use
    iFile = FreeFile
     
     ' \\ ' Open file for input.
    Open sFile For Input As #iFile
     
     ' \\ Return (Read) the whole content of the file to the function
    LoadTextFile = Input$(LOF(iFile), iFile)
     
    Close #iFile
     
End Function
 


I've tried it and it works for me

hope this helps,

laeijebor
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now