I'm having trouble with a Visual Basic/FileMaker integration I set up to create emails with attachments using Outlook for Windows. The problem is that the PDF attachments are not recognized by Outlook, instead the files are attaching as bitmaps (see image)
For another client, this same implementation has worked perfectly for years. Any theories for what might be causing the malfunction?
Here's the code:
Dim OutApp
Dim OutMail
Dim strbody
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "This is a test.<br><br>Sincerely,"
On Error Resume Next
With OutMail
.Display
.To = "test@test.com"
.CC = ""
.BCC = ""
.Subject = "This is a test"
.HTMLBody = strbody & "<br>" & .HTMLBody
.Attachments.Add("C:\Users\test\Desktop\test.pdf")
.Display
End With
On Error GoTo 0
Set strbody = Nothing
Set OutMail = Nothing
Set OutApp = Nothing
Does it happen with all the PDFs? Perhaps that system has the PDF extension mapped to a wrong application? Perhaps there is something wrong with the file itself that it just looks like a PDF? Perhaps it was inserted into FM as a picture instead of a file?
In this application we're using FileMaker to generate PDF's and store them in a subfolder on the user's desktop. On all attempts, the PDF's are successfully generated and stored, and they're readable, it's just something's broken with the attaching to emails, which are otherwise created with desired To, Subj, and Body. I'm wondering if there might be something in the file's names that could be the issue-- I just set up a test for my client to test the theory and will report back if it's successful.
Thanks for the suggestion re: the Microsoft API. Since there's some time sensitivity with this project and the number of emails to send is only ~80 my client is probably going to just hand-attach the PDF's to my auto-generated emails unless I can figure out this issue in the next couple days (fingers crossed). I'm guessing switching to an unknown-to-me technique would take longer than my client would want to wait.