I am using CDO to email a file as an attachment. The receiver receives
the file, but when he opens the file (tried using both Acrobat Reader
6 and 5), he gets "There was an error opening this document. The file
is damaged and could not be repaired." (similar error on Acrobat
Reader 5--Root object is missing) This pdf file opens fine on the
workstation from where I am transmitting. I have tried other pdf
files, but exact problem happens with all the pdf files. I tried
copying this suppossedly damaged file to other machine, assuming the
machine on which I am opening has Acrobat installed incorrectly, but
on other machines also, I get the same error. I also tried putting
sleep before sending, assuming that would solve the problem, but of no
avail. I tried transmitting other types of files, such as txt, mdb,
dbf, and exe. Those transmit fine and open correctly on the receiving
end. Just as a note that the size of the pdf file on the receiving end
changes (though slightly--increases). I know this is not good, but I
am not doing anything, which would change the size.
Could anybody help me solve this problem, so I can successfully
transmit pdf files, using CDO?
Thanks
---------------
Public Sub EmailPDF()
Dim iMsg, iConf, Flds, Fld
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
iMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 2
iMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "smarthost"
iMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
With iMsg
Set .Configuration = iConf
.To = """User A"" <ab*@xyz.com>"
.From = """User B"" <de*@xyz.com>"
.Subject = "Attached Doc"
.AddAttachment "c:\abc.pdf"
.send
End With