We help IT Professionals succeed at work.

MS ACCESS file show error [Error in Loading DLL] in VBA code that sends email via outlook

iymanb
iymanb asked
on
150 Views
Last Modified: 2017-03-24
I need to put VBA code in MS ACCESS file to send emails,
I used the date type outlook.applicatoin,

I get error message : [that user-defined type NOT defined]
So I go Tools>References and click checkbox "Microsoft Outlook 15.0 Object Library"

Now the error message says : Error in Loading DLL  

It appears at this line of code :

        Set MailOutLook = appOutLook.CreateItem(olMailItem)
UU.png
Comment
Watch Question

John TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Have you checked that your reference is OK?
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
try late-binding.
Dim appOutlook  As Object
Dim MailOutlook  As Object

Open in new window

Object variables also need to be released at the end
   Set appOutlook = Nothing
   Set MailOutlook = Nothing

Open in new window

with late-biding, you will need to use 0 (zero) instead of olMailItem

Author

Commented:
The reference i have checked is [ Microsoft Outlook 15.0 Object Library] ;

The issue to notice here is that I run this email procedure monthly; and up to last month it was working fine.
Now, I am using same code, same PC , same Office version, and suddenly this error appeared.
UU.png
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
John TsioumprisSoftware & Systems Engineer
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and Programming
CERTIFIED EXPERT
Top Expert 2015

Commented:
glad you got it ~ happy to help

Author

Commented:
My comment worked because it was like a trick .,
I don't understand how it worked, it just worked and resolved my problem.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.