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
Nov 15 '05
12 6091
Hi Wei-Dong Xu,
Are you saying that it is impossible to get hold of the
actual object from the add in code that i showed you
before?
I don't understand how a macro helps here. I don't see an
obvious API to create or call such a macro from my C# add
in.
I think you are saying that i should do something like;
application.bui ldNamedMacroCal l("macroName" ,
stringWithMacro Commands)
application.cal lTheNamedMacroJ ustCreated()
PLEASE PROVIDE AN EXAMPLE.
Thank You
Mark -----Original Message----- Hi Mark,
Thank you for replying!
I'd suggest that you can build one marco for your
inserted ActiveX control, then you can all the macro in
your add-in. In this way, you don't need toretrieve the object type information of the inserted
ActiveX control. Please feel free to let me know if you have any further
questions. Does this answer your question? Thank you for using
Microsoft NewsGroup! Wei-Dong Xu Microsoft Product Support Services Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and
confers no rights.
.
Hi Wei-Dong Xu,
Are you saying that it is impossible to get hold of the
actual object from the add in code that i showed you
before?
I don't understand how a macro helps here. I don't see an
obvious API to create or call such a macro from my C# add
in.
I think you are saying that i should do something like;
application.bui ldNamedMacroCal l("macroName" ,
stringWithMacro Commands)
application.cal lTheNamedMacroJ ustCreated()
PLEASE PROVIDE AN EXAMPLE.
Thank You
Mark -----Original Message----- Hi Mark,
Thank you for replying!
I'd suggest that you can build one marco for your
inserted ActiveX control, then you can all the macro in
your add-in. In this way, you don't need toretrieve the object type information of the inserted
ActiveX control. Please feel free to let me know if you have any further
questions. Does this answer your question? Thank you for using
Microsoft NewsGroup! Wei-Dong Xu Microsoft Product Support Services Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and
confers no rights.
.
..
-----Original Message----- Hi Mark,
Thank you for replying!
I'd suggest that you can build one marco for your
inserted ActiveX control, then you can all the macro in
your add-in. In this way, you don't need toretrieve the object type information of the inserted
ActiveX control. Please feel free to let me know if you have any further
questions. Does this answer your question? Thank you for using
Microsoft NewsGroup! Wei-Dong Xu Microsoft Product Support Services Get Secure! - www.microsoft.com/security This posting is provided "AS IS" with no warranties, and
confers no rights.
.
Hello Mark,
Try the following example, based onthe Microsoft Knowledge Base article
302902:
Add a Project Reference to the Micosoft Excel PIA
Add the following to the Usings
using System.Windows. Forms;
using Excel = Microsoft.Offic e.Interop.Excel ;
Change the declaration of the applicationObje ct to
private Excel.Applicati on applicationObje ct;
private void MyButton_Click( CommandBarButto n cmdBarbutton,re f bool
cancel)
{
try
{
//Get the workbooks collection.
Excel.Workbooks objBooks_Late =
(Excel.Workbook s)applicationOb ject.GetType(). InvokeMember( "Workbooks" ,
BindingFlags.Ge tProperty, null, applicationObje ct, null );
//Get the active workbook.
object[] Parameters;
Excel.Workbook objBook_Late = objBooks_Late[1];
//Get the worksheets collection.
Excel.Sheets objSheets_Late = objBook_Late.Wo rksheets;
//Get the first worksheet.
Excel.Worksheet objSheet_Late = (Excel.Workshee t)objSheets_Lat e[1];
// Get workbook
// TEST LINE #1
Microsoft.Vbe.I nterop.VBProjec t obVBP = objBook_Late.VB Project;
// More Code that creates and inserts strings into a
VBIDE.VBCompone nt code module.
//¡*¡*
//¡*¡*
}
catch(Exception ex)
{
System.Windows. Forms.MessageBo x.Show("Why this Error?: "
+ ex.Message);
}
}
Chris Jensen (Microsoft) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bijay Kumar |
last post by:
Hi Guys,
I was going through the source code of Object.cs in rotor. What I found is
Equals() implemented as follows:
public extern virtual bool Equals(Object obj);
What I don't understand is:
|
by: Bijay Kumar |
last post by:
Hi Guys,
I was going through the source code of Object class (Object.cs in rotor). What I found is
Equals() implemented as follows:
public extern virtual bool Equals(Object obj);
What I don't understand is:
|
by: Matthew |
last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML
file.
I call it like so:
Dim mySettings As mySettings = New mySettings
mySettings.value1 = "someText"
mySettings.value2 = "otherText"
xmlSave("C:\folder\file.xml", mySettings)
Here is the sub:
Public Shared Sub xmlSave(ByVal path As String, ByVal config As
|
by: Kevin Prichard |
last post by:
Hi all,
I've recently been following the object-oriented techiques discussed
here and have been testing them for use in a web application. There is
problem that I'd like to discuss with you experts.
I would like to produce Javascript classes that can be "subclassed"
with certain behaviors defined at subclass time. There are plenty of
ways to do this through prototyping and other techniques, but these
behaviors need to be static and...
|
by: Michael Moreno |
last post by:
Hello,
In a class I have this code:
public object Obj;
If Obj is a COM object I would like to call in the Dispose() method the
following code:
System.Runtime.InteropServices.Marshal.ReleaseComObject(Obj);
| |
by: yb |
last post by:
Hi,
Is there a standard for the global 'window' object in browsers? For
example, it supports methods such as setInterval and clearInterval, and
several others.
I know that w3c standardized several parts of the DOM, but this does
not include the window object.
Thank you
|
by: User1014 |
last post by:
A global variable is really just a property of the "Global Object", so
what does that make a function defined in the global context? A method
of the Global Object?
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Defining_Functions
doesn't actually give any insight.
|
by: Ralph |
last post by:
Hi
I don't understand why it's not working:
function schedule(imTop){
this.tdImagesTop = imTop;
}
schedule.prototype.selectEl = function() {
alert(this.tdImagesTop);
|
by: Astley Le Jasper |
last post by:
Sorry for the numpty question ...
How do you find the reference name of an object?
So if i have this
bob = modulename.objectname()
how do i find that the name is 'bob'
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |