View Single Post
 
Old 01-02-2014, 06:10 AM
OTPM OTPM is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Apr 2011
Location: West Midlands
Posts: 981
OTPM is on a distinguished road
Default User-defined Type not Defined VBA Issue

Hi Folks
I have some sample code from the web to open an mpp file but I am getting the following error message on the first few lines of code as shown below:

Sub Sample()
Dim appProj As MSProject.Application
Dim aProg As MSProject.Project
Dim wb As Workbook
Dim ws As Worksheet

Error message: User-defined type not defined

I have ticked the Reference to Microsoft Office 14.0 Object Library and I am using Office/Project 2010.
I have also referenced the Microsoft DAO 3.6 Object Library.

Any advice would be appreciated to resolve this issue.

Kind regards

Tony

Post script: Just found the issue, I was missing two References for MS Project.
Reply With Quote