Automation to Excel. Can't compile. Get __missing_type__ error for _CommandBars

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I am trying to use the Automation interface to programatically access Excel.  A sample program builds and runs fine on my co-workers system, but produces compile errors on mine.  We both have Visual Studio 2005 and Office 2007.  He runs XP, and I run Vista Ultimate.

Here are my imports:
<font color="#0000ff" size=2>
#include</font> <font color="#800000" size=2>"stdafx.h" </font><font color="#0000ff" size=2>
#include</font> <font color="#800000" size=2><atlbase.h> </font><font color="#0000ff" size=2>
#include</font> <font color="#800000" size=2><atlcom.h> </font><font color="#0000ff" size=2>
#include</font> <font color="#800000" size=2>"PRJTest.h" </font><font color="#0000ff" size=2>
#include</font> <font color="#800000" size=2>"PRJTestDlg.h" </font><font color="#0000ff" size=2>
#import</font> <font color="#800000" size=2>"C:Program FilesCommon FilesMicrosoft SharedOFFICE12mso.dll"</font><font size=2> rename(</font><font color="#800000" size=2>"RGB"</font><font size=2>, </font><font color="#800000" size=2>"MSRGB"</font><font size=2>) </font><font color="#0000ff" size=2>
#import</font> <font color="#800000" size=2>"C:Program FilesCommon FilesMicrosoft SharedVBAVBA6VBE6EXT.OLB"</font><font size=2> raw_interfaces_only, rename(</font><font color="#800000" size=2>"Reference"</font><font size=2>, </font><font color="#800000" size=2>"ignorethis"</font><font size=2>), rename(</font><font color="#800000" size=2>"VBE"</font><font size=2>, </font><font color="#800000" size=2>"testVBE"</font><font size=2>) </font><font color="#0000ff" size=2>
#import</font> <font color="#800000" size=2>"C:Program FilesMicrosoft OfficeOFFICE12excel.exe"</font><font size=2> exclude(</font><font color="#800000" size=2>"IFont"</font><font size=2>, </font><font color="#800000" size=2>"IPicture"</font><font size=2>) rename(</font><font color="#800000" size=2>"RGB"</font><font size=2>, </font><font color="#800000" size=2>"ignorethis"</font><font size=2>), rename(</font><font color="#800000" size=2>"DialogBox"</font><font size=2>, </font><font color="#800000" size=2>"ignorethis"</font><font size=2>), rename(</font><font color="#800000" size=2>"VBE"</font><font size=2>, </font><font color="#800000" size=2>"testVBE"</font><font size=2>), rename(</font><font color="#800000" size=2>"ReplaceText"</font><font size=2>, </font><font color="#800000" size=2>"EReplaceText"</font><font size=2>), rename(</font><font color="#800000" size=2>"CopyFile"</font><font size=2>,</font><font color="#800000" size=2>"ECopyFile"</font><font size=2>), rename(</font><font color="#800000" size=2>"FindText"</font><font size=2>, </font><font color="#800000" size=2>"EFindText"</font><font size=2>), rename(</font><font color="#800000" size=2>"NoPrompt"</font><font size=2>, </font><font color="#800000" size=2>"ENoPrompt"</font><font size=2>)

</font><font color="#0000ff" size=2>
#import</font> <font color="#800000" size=2>"C:Program FilesMicrosoft OfficeOFFICE12MSPRJ.OLB"</font><font size=2> auto_search exclude(</font><font color="#800000" size=2>"IFont"</font><font size=2>, </font><font color="#800000" size=2>"IPicture"</font><font size=2>) rename(</font><font color="#800000" size=2>"RGB"</font><font size=2>, </font><font color="#800000" size=2>"ignorethis"</font><font size=2>), rename(</font><font color="#800000" size=2>"DialogBox"</font><font size=2>, </font><font color="#800000" size=2>"ignorethis"</font><font size=2>), rename(</font><font color="#800000" size=2>"VBE"</font><font size=2>, </font><font color="#800000" size=2>"testVBE"</font><font size=2>), rename(</font><font color="#800000" size=2>"ReplaceText"</font><font size=2>, </font><font color="#800000" size=2>"EReplaceText"</font><font size=2>), rename(</font><font color="#800000" size=2>"CopyFile"</font><font size=2>,</font><font color="#800000" size=2>"ECopyFile"</font><font size=2>), rename(</font><font color="#800000" size=2>"FindText"</font><font size=2>, </font><font color="#800000" size=2>"EFindText"</font><font size=2>), rename(</font><font color="#800000" size=2>"NoPrompt"</font><font size=2>, </font><font color="#800000" size=2>"ENoPrompt"</font><font size=2>) </font>

On compile, I get error messages:
<font size=1>
#import referenced a type from a missing type library; __missing_type__ used as a placeholder
1>c:userssnilesdocumentsvisual studio 2005source10prjtestprjtestdebugvbe6ext.tlh(463) : error C2061: syntax error : identifier __missing_type__

<font style="font-size:12px The line in vbe6ext.tlh that complains is:
<font size=2>
</font><font color="#0000ff" size=2>virtual</font><font size=2> HRESULT </font><font color="#0000ff" size=2>__stdcall</font><font size=2> get_CommandBars (
</font><font color="#008000" size=2>/*[out,retval]*/</font><font size=2> __missing_type__ * * ppcbs ) = 0;

The missing type is _CommandBars

Ive seen this problem reported in various forums, but I have yet to see anyone receive any answer.(example:  http://www.codeguru.com/forum/archive/index.php/t-263709.html http://www.codeguru.com/forum/archive/index.php/t-263709.html ) </font></font></font>

View the full article
 
Back
Top