WhtChoklat
Technical User
I am trying to email a file that I am generating from a report. The file is being created successfully, but I am getting an error when I try to read the information or email it, I am not sure where the error is occuring. Here is my coding:
Dim txtTO, txtCC, txtBCC, txtSubject, txtMessage, message As String
Dim outFile, filename, date1, path, ext As String
Dim f, ts
MyDate = Date
date1 = Format(MyDate, "mmm d yyyy"
path = pathname
ext = ".rtf"
filename = "Minutes_" + date1
outFile = path + filename + ext
DoCmd.OutputTo acOutputReport, "Minutes - Report", acFormatRTF, outFile, False
Set f = outFile
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
message = ts.ReadAll
ts.Close
txtTO = "riche@pjm.com"
txtCC = ""
txtBCC = ""
txtSubject = "Today's CMB Minutes"
txtMessage = message
DoCmd.SendObject acSendReport, "Minutes - Report", acFormatRTF, txtTO, txtCC, txtBCC, txtSubject, txtMessage, False
I hope someone can help me or at least point me in the right direction. Thanks in advance
Dim txtTO, txtCC, txtBCC, txtSubject, txtMessage, message As String
Dim outFile, filename, date1, path, ext As String
Dim f, ts
MyDate = Date
date1 = Format(MyDate, "mmm d yyyy"
path = pathname
ext = ".rtf"
filename = "Minutes_" + date1
outFile = path + filename + ext
DoCmd.OutputTo acOutputReport, "Minutes - Report", acFormatRTF, outFile, False
Set f = outFile
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
message = ts.ReadAll
ts.Close
txtTO = "riche@pjm.com"
txtCC = ""
txtBCC = ""
txtSubject = "Today's CMB Minutes"
txtMessage = message
DoCmd.SendObject acSendReport, "Minutes - Report", acFormatRTF, txtTO, txtCC, txtBCC, txtSubject, txtMessage, False
I hope someone can help me or at least point me in the right direction. Thanks in advance