How to Access Properties of Control

A

Ahmad Jalil Qarshi

hi!

i have placed my own activex control into Word document using following
function.

CComVariant varClsType("Ascertia.AscertiaObj.1");
MSWord::InlineShapePtr MyObj =
m_pWordApp->Selection->InlineShapes->AddOLEObject(&varClsType);

Now my activex control has different get and set properties like Caption,
BKColor,MyData etc. I want to access and modify those properties using VBA
or prefferably VC++ code from within Word.

anybody there to give me a hand.
Thanks in advance.
Ahmad Jalil Qarshi
 
A

Alexander Nickolov

The name of the method suggests you are adding your control
as an OLE insertable object, not as a control. These are not
presumed to support Automation and are controlled by the
container (Word) directly. I don't know Word, so can't tell you
any specifics, but you may consider looking for a different way
of adding your object (or I may be wrong). Ask this question
in the office groups. For example:

microsoft.public.office.developer.automation

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: (e-mail address removed)
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
 
A

Ahmad Jalil Qarshi

Thanks Alexander!
you are right i didn't add my control as an activex control. now i have
added it using AddOLEControl. it return the InlineShapePtr which contains a
member OLEFormat. i used OLEFormat's GetObject function to return the
IDispatchPtr and so i accessed my Control's properties successfully.
Thanks again.
Ahmad Jalil Qarshi


Alexander Nickolov said:
The name of the method suggests you are adding your control
as an OLE insertable object, not as a control. These are not
presumed to support Automation and are controlled by the
container (Word) directly. I don't know Word, so can't tell you
any specifics, but you may consider looking for a different way
of adding your object (or I may be wrong). Ask this question
in the office groups. For example:

microsoft.public.office.developer.automation

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: (e-mail address removed)
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Ahmad Jalil Qarshi said:
hi!

i have placed my own activex control into Word document using following
function.

CComVariant varClsType("Ascertia.AscertiaObj.1");
MSWord::InlineShapePtr MyObj =
m_pWordApp->Selection->InlineShapes->AddOLEObject(&varClsType);

Now my activex control has different get and set properties like Caption,
BKColor,MyData etc. I want to access and modify those properties using VBA
or prefferably VC++ code from within Word.

anybody there to give me a hand.
Thanks in advance.
Ahmad Jalil Qarshi
 

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