dsofile CustomProperties C++ Add method error 0x80020008

H

Harald Fröba

Hi,

I'm using the dsofile to manipulate the document properties of word files
with visual c++.
I can manipulate existing entries( custom/built in ).
Now I want to add custom entries.
To manage this I use the Add method of the CustomProperties interface.

HRESULT Add( [in] BSTR sPropName, [in] VARAINT* Value, [out, retval]
CustomProperty** ppDocProperty );

Here is my Code:
BSTR Name = L"NewField"

VARIANT Value;

Value.vt = VT_BSTR;

Value.bstrVal = L"NewValue";

Hr = AutoWrap( DISPATCH_METHOD, &Result, CustomPropertiesP, L"Add", 2,
Value, Name );

I have tried all of the possible Values, but I get always the error:

Hr 0x80020008 Falscher Variablentyp.

I have a demo program in visual basic and there is no problem to add
properties.

Can anyone help me to interpret the [in] VARAINT* Value in C++ or have
anyone a sample code snippet
in C++?

Any help would be appreciated!!
Thanks for your time.

Regards,
Harald
 

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