B
Benjamin Salcetti
I'm trying to save the body of an email sent out by a macro as an html
file on a shared drive. The body is mstrBody, already defined as a
string. The portion between the stars is what I've written in attempt
to save this, while the rest is part of a much longer macro. Stepping
through the code yields no problems, and running the entire set of
macros that governs this process will work fine, but nothing will be
saved. Could somebody help me figure out how to get this saved
properly?
Thanks
'Set the values for the email notification
With moEmailEng
.To = GetEMailAddressList(moTo)
.From = GetEMailAddressList(moFrom)
If GetEMailAddressList(moCC) <> "" Then
.CC = GetEMailAddressList(moCC)
End If
If GetEMailAddressList(moBCC) <> "" Then
.BCC = GetEMailAddressList(moBCC)
End If
'MsgBox "re-inserted stmts re: Attachments"
For intIndex = 1 To moAttachments.Count
If Trim(moAttachments(intIndex)) <> "" Then
.AddAttachment Trim(moAttachments(intIndex))
End If
Next intIndex
.Subject = mstrSubject
.HTMLBody = mstrBody
'*************************************************************************************************************************
'This next bit attempts to save the body as an html file on
the S Drive.
Dim UserName As String
Dim TimeInMS As String
UserName = Application.UserName
TimeInMS = Strings.Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." &
Strings.Right(Strings.Format(Timer, "#0.00"), 2)
Dim F As Long
Dim FileName As String
FileName = "S:\Research\Shared\RATINGS MACROS\Archived Macro
Emails\" & UserName & "RatingsEmail" & TimeInMS & ".html"
F = FreeFile
Open FileName For Output As #F
Print #F, mstrBody
Close #F
'*************************************************************************************************************************
'Send Email -- THIS ACTUALLY SENDS EMAIL
.Send
End With
file on a shared drive. The body is mstrBody, already defined as a
string. The portion between the stars is what I've written in attempt
to save this, while the rest is part of a much longer macro. Stepping
through the code yields no problems, and running the entire set of
macros that governs this process will work fine, but nothing will be
saved. Could somebody help me figure out how to get this saved
properly?
Thanks
'Set the values for the email notification
With moEmailEng
.To = GetEMailAddressList(moTo)
.From = GetEMailAddressList(moFrom)
If GetEMailAddressList(moCC) <> "" Then
.CC = GetEMailAddressList(moCC)
End If
If GetEMailAddressList(moBCC) <> "" Then
.BCC = GetEMailAddressList(moBCC)
End If
'MsgBox "re-inserted stmts re: Attachments"
For intIndex = 1 To moAttachments.Count
If Trim(moAttachments(intIndex)) <> "" Then
.AddAttachment Trim(moAttachments(intIndex))
End If
Next intIndex
.Subject = mstrSubject
.HTMLBody = mstrBody
'*************************************************************************************************************************
'This next bit attempts to save the body as an html file on
the S Drive.
Dim UserName As String
Dim TimeInMS As String
UserName = Application.UserName
TimeInMS = Strings.Format(Now, "dd-MMM-yyyy HH:nn:ss") & "." &
Strings.Right(Strings.Format(Timer, "#0.00"), 2)
Dim F As Long
Dim FileName As String
FileName = "S:\Research\Shared\RATINGS MACROS\Archived Macro
Emails\" & UserName & "RatingsEmail" & TimeInMS & ".html"
F = FreeFile
Open FileName For Output As #F
Print #F, mstrBody
Close #F
'*************************************************************************************************************************
'Send Email -- THIS ACTUALLY SENDS EMAIL
.Send
End With