VBA Run-time error '48': Error in loading DLL

leishtheman

New Member
Joined
Oct 1, 2007
Messages
32
Hello

I've been experiencing a tricky vba problem to which I can't find the solution on Mr Excel or anywhere else...

I have an Excel file which opens an Outlook session and builds an email with the TO, CC, and BCC names populated dynamically based upon my selections in the Excel file. 50% of the time everything works fine, but 50% of the time I get a Run-time error '48': Error in loading DLL, whereby the code always trips up on the 2nd of the following 2 lines:

set Out = CreateObject("Outlook.Application")
set mail = Out.CreateItem(olMailItem)

The only advice I have come across on the web suggests making sure I have the correct library references available, particularly the Microsoft Outlook Object Library, but I've checked the libraries both when it trips up and when it doesn't and there is no visible difference so I don't think this is the problem. In both scenarios the following library references are ticked:

Visual Basic For Applications
Microsoft Excel 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Object Library
Microsoft Forms 2.0 Object Library
Microsoft Outlook 15.0 Object Library

I have a suspicion the error occurs more often when Outlook is already loaded compared to when it isn't already loaded, but I can't prove this and the error definitely occurs under both circumstances in any instance. I'm using (the god awful) Excel 2013.

Any gurus got any ideas about how to get round this???

Many thanks in advance,

Andy Leishman.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top