J
Jeff G
All -
I have just ran into an issue that is making my head spin. I have a process
that imports a CSV file, manipulates it, exports an Excel query and e-mails
the query. Snippets are listed below:
Dim strFolder As String
Dim Signature As String, SigString As String
Dim OLApp As Outlook.Application
Dim OLMsg As Outlook.MailItem
....
....
....
DoCmd.OutputTo acOutputQuery, "QueryName", acFormatXLS,
"C:\Temp\DatabaseExport\ExcelFile.xls"
Set OLApp = New Outlook.Application
Set OLMsg = OLApp.CreateItem(olMailItem)
SigString = "C:\Documents and Settings\" & Environ("username") &
"\Application Data\Microsoft\Signatures\Default.htm"
If Dir(SigString) <> "" Then
Signature = Get_Signature(SigString)
Else
Signature = ""
End If
With OLMsg
.Display
.To = "(e-mail address removed)"
.Subject = "Message Subject"
.HTMLBody = "<html><body>" & "Please see the attached file for ..." &
"<html><br><br><br></body></html>" & Signature
.Attachments.Add "C:\Temp\DatabaseExport\ExcelFile" & ".xls"
Kill "C:\Temp\DatabaseExport\ExcelFile.xls"
End With
Set OLMsg = Nothing
Set OLApp = Nothing
Now...here's the part I don't understand. All works fine as long as Outlook
is open. If it is not, I get everything EXCEPT the attachment in the new
e-mail.
Anyone have ideas?
Thanks in advance.
I have just ran into an issue that is making my head spin. I have a process
that imports a CSV file, manipulates it, exports an Excel query and e-mails
the query. Snippets are listed below:
Dim strFolder As String
Dim Signature As String, SigString As String
Dim OLApp As Outlook.Application
Dim OLMsg As Outlook.MailItem
....
....
....
DoCmd.OutputTo acOutputQuery, "QueryName", acFormatXLS,
"C:\Temp\DatabaseExport\ExcelFile.xls"
Set OLApp = New Outlook.Application
Set OLMsg = OLApp.CreateItem(olMailItem)
SigString = "C:\Documents and Settings\" & Environ("username") &
"\Application Data\Microsoft\Signatures\Default.htm"
If Dir(SigString) <> "" Then
Signature = Get_Signature(SigString)
Else
Signature = ""
End If
With OLMsg
.Display
.To = "(e-mail address removed)"
.Subject = "Message Subject"
.HTMLBody = "<html><body>" & "Please see the attached file for ..." &
"<html><br><br><br></body></html>" & Signature
.Attachments.Add "C:\Temp\DatabaseExport\ExcelFile" & ".xls"
Kill "C:\Temp\DatabaseExport\ExcelFile.xls"
End With
Set OLMsg = Nothing
Set OLApp = Nothing
Now...here's the part I don't understand. All works fine as long as Outlook
is open. If it is not, I get everything EXCEPT the attachment in the new
e-mail.
Anyone have ideas?
Thanks in advance.