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.
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.