I’m using the following code to embed a word document into the body of an email, then send the email to the intended party (names have been changed accordingly). The problem is that the new service pack for Outlook 2000, in its attempt to circumvent “bad” attachments, is not happy with what we’re trying to do, and this ends up in the ultimate loop ‘o doom as the user tries to click the “yes” button when the explanatory “are you sure you want to send this attachment because some attachments can contain viruses” window pops up over and over and over again, until the user ctrl/alt/dels the whole process, which ends up eventually corrupting the database.
Here’s the innocent code:
tempFilePath = CurDir
tempFilePath = tempFilePath & “” & “Temp.txt”
DoCmd.OpenReport “R_FcstDiff”, acViewPreview
DoCmd.OutputTo acOutputReport, “R_MickeyDiff”, acFormatTXT, tempFilePath
DoCmd.Close acReport, “R_MickeyDiff”
fnum = FreeFile()
‘opens temporary .txt file, and inputs into the body of the email
Open tempFilePath For Input As fnum
FileContents = Input$(LOF(fnum), fnum)
Close #fnum
‘set the mailrecip string (called Recipient in the sub)
‘this opens outlook for those of us who forget all the time
If isAppRunning(“outlook.application”) = False Then
Shell (“outlook.exe”)
Else
End If
‘heres where it creates the email
MailRecip = “minniemouse@imtrying.organza”
MailCC1 = DLookup(“mailname”, “tblUser”, “user ” & “””” & ” ” & “”””) & “@imtrying.organza”
MailCC2 = ” ”
MailSubj = “Adjusted Item for ” & Me.PLine
bpurge = True ‘this will prevent the message from being saved in the sent items
‘ should be set to false if copy needs to be saved
bpreview = False ‘ this will send the message instead of displaying it and waiting for you to send it
‘sends out email
Call SendMail(MailSubj, FileContents, MailRecip, MailCC1, MailCC2, bpreview, bpurge)
‘deletes .txt file
Kill tempFilePath
I think the irritating Outlook situation is occurring when the Sendmail is called.
Does anyone have any suggestions, other than uninstalling this service pack?
The sysadm is sort of peeved at me.