Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2015, 10:41 AM
shawnhet shawnhet is offline Problem with Word Mail Merge VBA - Outlook Object Library not recognized Windows 7 32bit Problem with Word Mail Merge VBA - Outlook Object Library not recognized Office 2013
Novice
Problem with Word Mail Merge VBA - Outlook Object Library not recognized
 
Join Date: Apr 2015
Posts: 2
shawnhet is on a distinguished road
Default Problem with Word Mail Merge VBA - Outlook Object Library not recognized

Hi everyone,



I am having a problem with the email merge macro
Sub emailmergewithattachments() now that I've upgraded to Office 2013.

I keep getting the Compile Error: User-Defined type not defined for the following line in the macro.

Dim oOutlookApp As Outlook.Application

Typically, for this macro to work one needs open the VB Editor and get it to recognize the Microsoft Outlook 15.0 Object Library by checking that box under Tools >> References and hitting OK.

However, this does not do the trick for Word/Outlook 2013 apparently. This error persists even after the above mentioned box is checked.

I'm hoping that someone can help me with this. That macro is super useful for what I am doing.

Does anyone have any ideas what might be causing the problem?

Thanks a lot!

Shawn
Reply With Quote
  #2  
Old 04-14-2015, 10:15 PM
gmayor's Avatar
gmayor gmayor is offline Problem with Word Mail Merge VBA - Outlook Object Library not recognized Windows 7 64bit Problem with Word Mail Merge VBA - Outlook Object Library not recognized Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Uncheck the Microsoft Outlook object library and change the code to late binding. In this case
Code:
Dim oOutlookApp As Object
There will undoubtedly be other lines that need changing and calls to Outlook specific commands will have to be replaced by their numeric equivalents, but it should make the macro less reliant on Office versions.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 04-15-2015, 07:51 AM
shawnhet shawnhet is offline Problem with Word Mail Merge VBA - Outlook Object Library not recognized Windows 7 32bit Problem with Word Mail Merge VBA - Outlook Object Library not recognized Office 2013
Novice
Problem with Word Mail Merge VBA - Outlook Object Library not recognized
 
Join Date: Apr 2015
Posts: 2
shawnhet is on a distinguished road
Default

Thanks, Graham. I'll give it a shot. (Once I learn how late binding affects the code anyway ).
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Word Mail Merge VBA - Outlook Object Library not recognized Microsoft Excel 12.0 Object Library reference upload chamdan Project 2 04-21-2014 06:30 AM
Mail Merge using Word 2010 - Header source not be recognized Gage262 Word 8 02-01-2012 11:08 AM
Problem with Word Mail Merge VBA - Outlook Object Library not recognized Excel VBA: How to add a reference to Microsoft Word Object Library? tinfanide Excel Programming 7 12-12-2011 05:21 AM
Problem: object library invalid or contains references to object definitions aligahk06 Office 0 08-19-2010 12:29 PM
Access Object library 10 Gyto Office 0 10-09-2008 09:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft