tl;dr - Converted from early to late binding to email a report using Outlook, now getting "Error in Loading DLL"
Good morning! I developed a tool for our production operations that automatically generates an email when a report is run. It was working fine for me using early binding, but then I was asked to roll it out to multiple users so I converted to late binding. It still works fine for me, but the other users are getting "Error in Loading DLL" faults when running the report. I thought the entire point of late binding was avoiding compatability issues across different versions of Excel?
Anyway, here's my code:
Anything obviously wrong?
Good morning! I developed a tool for our production operations that automatically generates an email when a report is run. It was working fine for me using early binding, but then I was asked to roll it out to multiple users so I converted to late binding. It still works fine for me, but the other users are getting "Error in Loading DLL" faults when running the report. I thought the entire point of late binding was avoiding compatability issues across different versions of Excel?
Anyway, here's my code:
Code:
' Save and capture some variables
ThisWorkbook.Save
Dim DateCode
DateCode = Range("E4")
Dim EmailDate
EmailDate = Range("B4")
Dim FileNaem
FileNaem = Range("B3")
' Open Email to send results
Dim OutApp As Object, objOutlookMsg As Object, objOutlookRecip As Object, Recipients As Object
Set OutApp = CreateObject("Outlook.Application")
Set objOutlookMsg = OutApp.CreateItem(0)
Set Recipients = objOutlookMsg.Recipients
Set objOutlookRecip = Recipients.Add("[EMAIL="people@places.com"]people@places.com[/EMAIL]")
objOutlookRecip.Type = 1
objOutlookMsg.Subject = EmailDate & " " & FileNaem
objOutlookMsg.Attachments.Add ActiveWorkbook.FullName
For Each objOutlookRecip In objOutlookMsg.Recipients
objOutlookRecip.Resolve
Next
Application.ScreenUpdating = True
objOutlookMsg.Display
Set OutApp = Nothing
Anything obviously wrong?