Hi Mark,
Thanks for posting in this group.
What is the error message when you convert shape.OLEFormat .Object to
ActiveXLib.myCo ntrolCtlClass?
I think may be you can use the typeof operator to determine the type of
shape.OLEFormat .Object.
Maybe you can try to use ActiveXLib.ImyC ontrol to get this interface.
Do you make sure that this object is a ActiveXLib.myCo ntrolCtlClass type?
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
| Content-Class: urn:content-classes:message
| From: "Mark" <mh*@yadayada.c om>
| Sender: "Mark" <mh*@yadayada.c om>
| Subject: C# and OLEFormat.Objec t?
| Date: Fri, 24 Oct 2003 08:53:01 -0700
| Lines: 32
| Message-ID: <0c************ *************** *@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcOaRudJlQHTzFP ER3avOahP1Ww40A ==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1938 41
| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| I have a C# add in that inserts a custom active x control
| into a worksheet.
|
| Once the object is inserted i can locate the object
| through both Shapes and Worksheet.OLEOb jects. What I
| can't do is figure out how to use the object
| programatically .
|
| I added a reference to the object in the Visual Studio
| project by importing the object OCX. The reference shows
| up as Interop.ActiveX Lib and my objects methods and
| properties are shown in the object browser under both
| interop.ActiveX Lib.ImyControl and
| interop.ActiveX Lib.myControlCt lClass.
|
| I have tried various arrangements of casting the object
| returned from both Shapes and Worksheet's OLEFormat.Objec t
| trying to get something that I can use directly with no
| success:
|
| ActiveXLib.myCo ntrolCtlClass mc =
| (ActiveXLib.myC ontrolCtlClass) shape.OLEFormat .Object;
|
| I am writting the add in Visual Studio .Net and it is
| running in Excel 2002 Service Pack 1.
|
| What I want to do is to be able to use:
| mc.myControlMet hod(doIT).
|
| Thanks for the help
|
| Mark
|