Office 2007 "__missing_type__" while importing msword.olb

M

Mark Wilson

I’m trying to import a typelibrary for Office 12 and I have a couple of
systems where this is failing with the message
“error C4772: #import referenced a type from a missing type library;
'__missing_type__' used as a placeholderâ€.
This is in reference to the file msword.olb

I have 4 systems configured as follows:

A) Vista with Office 2007
B) XP/SP2 with Office 2003/SP3
C) XP/SP2 with Office XP/SP3
D) XP/SP2 with Office XP/SP3

All systems have the following files copied from an Office 2007
installation: mso.dll, vbe6ext.olb, msword.olb, and msoutl.olb.

The import statements are as follows:
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\mso.dll"
rename("RGB", "RGB_") \
rename("DocumentProperties", "DocProps") rename("FindText",
"WordFindText") \
rename("PlaySound", "OfficePlaySound")
using namespace Office;
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files\Microsoft Office\Office12\MSWORD.OLB"
rename("ExitWindows", "WordExitWindows") \
rename("FindText", "WordFindText")
#import "C:\Program Files\Microsoft Office\Office12\MSOUTL.OLB"
rename("CopyFile", "CopyFile_") \
rename_namespace("Outlook")
using namespace Outlook;

However, systems A and D compile without errors while systems B and C have
error C4772. Systems C and D have the same version of Windows and Office so
there must be something other than having the files mso.dll, vbe6ext.olb,
msword.olb, and msoutl.olb on the system for a successful #import of
msword.olb. Any idea why I might be getting this error?
 
J

Jialiang Ge [MSFT]

Hello Mark,

From your post, my understanding on this issue is: you wonder why the two
Windows XP systems with Office XP behave differently when you tries to
import the type libraries of Office 12 on them. If I'm off base, please
feel free to let me know.

In order to reproduce the issue, I did a test on a system with Windows XP
SP2, Office XP SP3 and Visual Studio 2005. I copied the mso.dll,
vbe6ext.olb, msword.olb and msoutl.olb from another system with Office
2007, then add the following content into a VC project's stdafx.h
#import "C:\program files\Common Files\Microsoft Shared\OFFICE12\mso.dll"
rename("RGB", "RGB_"), rename("DocumentProperties", "DocProps"),
rename("FindText", "WordFindText"), rename("PlaySound", "OfficePlaySound")
using namespace Office;
#import "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\1033\VBE6EXT.OLB"
#import "C:\Program Files\Microsoft Office\Office12\MSWORD.OLB"
rename("ExitWindows", "WordExitWindows"), rename("FindText", "WordFindText")
#import "C:\Program Files\Microsoft Office\Office12\MSOUTL.OLB"
rename("CopyFile", "CopyFile_"), rename_namespace("Outlook")
using namespace Outlook;

Then I find that the first compilation of the project does cause the errors
as you mentioned, but when I compile the project again, it passed the
compilation. Although this behavior of compilation is strange, importing
Office 2007 type libraries on a system with Office XP is not an expected
behavior according to the KB article
http://support.microsoft.com/kb/244167. If you want to writing Automation
clients for multiple Office versions, the supported behavior is to
reference the type library of the earliest version of the Office
application you intend to Automate. That is to say, we should #import
Office XP type libraries if our application supports Office XP and above.
Office applications that are tested and compiled with earlier versions of a
type library continue to work, unchanged, when end users of your product
upgrade their Office installations to a more recent version. In this way
Office provides *backward compatibility*. As for this issue, we are
referencing the most recent version of Office in an old version, therefore,
the compilation result is unpredictable. If you decide to support several
versions of Office at the same time, please refer to that KB
http://support.microsoft.com/kb/244167. Thanks.

Please let me know if you have any other concerns, or need anything else.

Sincerely,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mark Wilson

Thanks Jialiang.

I'm developing an Outlook Addin that needs to work with several versions of
Outlook. That includes supporting the Word editor in Outlook 2007. My Addin
knows which version of Outlook loaded it so it can execute version specific
code. For example the Outlook 2000 portion would not call any functions that
were specific to Outlook XP or newer. Therefore there would be no problems
at run-time.

What I really need to do is be able to get this project to compile on a
system with Outlook 2003 so that I can use VS2005 to debug on that system.
Unfortunately every time I build on the Outlook 2003 system I get the
"__missing_type__" error, not just the first compile.

The error says "#import referenced a type from a missing type library;" so
does that imply there is a missing file somewhere on my system?

If I copy the .TLI and .TLH files from a working system to this project, is
there some way that I can include them in the project without VS2005
recreating them every time it process an #import directive?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top