Visual Basic attaching PDF as Bitmap to Outlook email

Hi all,

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 
    .To = "" 
    .CC = "" 
    .BCC = "" 
    .Subject = "This is a test" 
    .HTMLBody = strbody & "<br>" & .HTMLBody 
End With 

On Error GoTo 0 
Set strbody = Nothing 
Set OutMail = Nothing 
Set OutApp = Nothing

Thanks for any hints you can provide!


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?

As an aside, you may want to look into talking to the Office APIs directly from inside FM for a tighter and easier integration: Microsoft Graph API for Office 365 Integrations in FileMaker: Part One

Thanks for the response.

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.