Create ProjectItem Error. (Core API)

I use IVbaProjItemCol::CreateDocumentProjItem to create a projectitem. The projectitem need call SetExtension toassociates an extension.

I findIVba::CreateExtensioncan create a extension. But i don't known how to using it.

Can someone help me? Thanks a lot.

[341 byte] By [flywind] at [2007-12-23]
# 1

What are you trying to accomplish? You mention API in your thread title, but the way you've described what you're doing, it sounds like you're working through .NET.

duckthing at 2007-8-31 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...
# 2

Thanks for your reply.

I have used Core API to integrated VBA 6.3 into my application.

The following is the document about the API. May someone please tell me what do CEO and EO mean?

IVba::CreateExtension

Generates the extension object for an associated controlling extensible object (CEO) and extensible object (EO).

HRESULT IVba::CreateExtension(punkOuter, punkBase, punkExtender, ppunkExtension);

IUnknown *punkOuter

IUnknown *punkBase

IUnknown *punkExtender

IUnknown ** ppunkExtension

Parameters

punkOuter

CEO IUnknown.

punkBase

EO IUnknown.

punkExtender

Reserved. Not used in this version of VBA.

ppunkExtension

The IUnknown interface for the extension object.

Return Value

The returned HRESULT value is one of the following:

Return valueMeaning
S_OKSuccess.
E_OUTOFMEMORYOut of memory.
E_INVALIDARGOne or more parameters are invalid.

Comments

It is not required that you set the extension using IVbaProjItem::SetExtension until you are expecting code to execute or the host is in a state where code might execute. For example, an event could fire where there is code behind it. This action associates an extension, a CEO and EO, with a document project item and the relevant document site.

IVba::CreateExtension can be called before a project is loaded or created.

flywind at 2007-8-31 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...