Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default DoubleClick on embedded object(shape)

Hello,

I embed in the active sheet many objects (of a certain ActiveX type)
that have a doubleClick event. I want to use the doubleClick to
trigger a userform taht show the the clicked object parameters.

The problem is that in order to double click a particular object, i
have to know the specific name or index of the object in order to use
a procedure Sub SpecificName_DblClick()

The number of embedded object (shapes) could vary and is not known in
advance

I'll be glad if someone could help me with what it looks quite a
tricky problem

Thanks a lot
Avi

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default DoubleClick on embedded object(shape)

Can you right click on an object and select view code?

--
Regards,
Tom Ogilvy


"avi" wrote:

Hello,

I embed in the active sheet many objects (of a certain ActiveX type)
that have a doubleClick event. I want to use the doubleClick to
trigger a userform taht show the the clicked object parameters.

The problem is that in order to double click a particular object, i
have to know the specific name or index of the object in order to use
a procedure Sub SpecificName_DblClick()

The number of embedded object (shapes) could vary and is not known in
advance

I'll be glad if someone could help me with what it looks quite a
tricky problem

Thanks a lot
Avi


  #3   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default DoubleClick on embedded object(shape)

No!

There is is a property item whe right clicking, but it triggers a
built-in form with no mention of the object name

Avi

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default DoubleClick on embedded object(shape)

Try this:
Sub aBC()
for each obj in ActiveSheet.OleObjects
obj.Select
msgbox obj.Object.Name & " - " & obj.Name
Next
End Sub


if obj.Select causes a problem, then comment it out and try it.

Also, if you select an object you should see its name in the namebox on the
Formula bar.
--
Regards,
Tom Ogilvy



"avi" wrote:

No!

There is is a property item whe right clicking, but it triggers a
built-in form with no mention of the object name

Avi


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default DoubleClick on embedded object(shape)

If you don't know what's present at design time, you'll have to write a
class module to handle the event, and instantiate an instance of the class
for each object that's present at run time. This might help get you started:

http://www.j-walk.com/ss/excel/tips/tip44.htm

It says UserForm buttons, but it should also work with worksheet controls.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"avi" wrote in message
oups.com...
Hello,

I embed in the active sheet many objects (of a certain ActiveX type)
that have a doubleClick event. I want to use the doubleClick to
trigger a userform taht show the the clicked object parameters.

The problem is that in order to double click a particular object, i
have to know the specific name or index of the object in order to use
a procedure Sub SpecificName_DblClick()

The number of embedded object (shapes) could vary and is not known in
advance

I'll be glad if someone could help me with what it looks quite a
tricky problem

Thanks a lot
Avi





  #6   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default DoubleClick on embedded object(shape)

Thanks for you help, but still don't know how to solve completely.
I have created a collection of the objects (a Gauge object activeX)
that work fine, but do not know how to associate the event DblClick
with its members. The ActiveX itself has this Event

Dim MyCollection As New Collection
Dim Gauges() As New Class1
Public i As Integer
Sub CollectionGauges()
Dim GaugeCount As Integer
Dim Gauge As OLEObject
GaugeCount = 0

For Each Gauge In ActiveSheet.OLEObjects
MyCollection.Add Gauge

GaugeCount = GaugeCount + 1
ReDim Preserve Gauges(1 To GaugeCount)
Set Gauges(GaugeCount).GaugesGroup = Gauge 'This line
return an error
Next

MsgBox ActiveSheet.OLEObjects(8).Object.Value 'This indeed
return the Value associate witj the ActiveX gauge

End Sub

The Class1 code is:

I have created Class1 but get an error message. I guess that I have to
create a Class and associate a DblClick event whith it but do not know
what kind of class to create. Should it be a collection?

Public WithEvents GaugesGroup As OLEObject
Private Sub GaugesGroup_DblClick()
MsgBox "Hello from " & GaugesGroup.Name
End Sub

Any guidance would help me a lot
Thanks again
Avi





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default DoubleClick on embedded object(shape)

Try this:

Set Gauges(GaugeCount).GaugesGroup = Gauge.Object

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"avi" wrote in message
ups.com...
Thanks for you help, but still don't know how to solve completely.
I have created a collection of the objects (a Gauge object activeX)
that work fine, but do not know how to associate the event DblClick
with its members. The ActiveX itself has this Event

Dim MyCollection As New Collection
Dim Gauges() As New Class1
Public i As Integer
Sub CollectionGauges()
Dim GaugeCount As Integer
Dim Gauge As OLEObject
GaugeCount = 0

For Each Gauge In ActiveSheet.OLEObjects
MyCollection.Add Gauge

GaugeCount = GaugeCount + 1
ReDim Preserve Gauges(1 To GaugeCount)
Set Gauges(GaugeCount).GaugesGroup = Gauge 'This line
return an error
Next

MsgBox ActiveSheet.OLEObjects(8).Object.Value 'This indeed
return the Value associate witj the ActiveX gauge

End Sub

The Class1 code is:

I have created Class1 but get an error message. I guess that I have to
create a Class and associate a DblClick event whith it but do not know
what kind of class to create. Should it be a collection?

Public WithEvents GaugesGroup As OLEObject
Private Sub GaugesGroup_DblClick()
MsgBox "Hello from " & GaugesGroup.Name
End Sub

Any guidance would help me a lot
Thanks again
Avi







  #8   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default DoubleClick on embedded object(shape)

Hello, Jon

It works!!!! many thanks!!

i've made also a slight change to the class, otherwise i get a Type
mismatch

Public WithEvents GaugesGroup As GaugeObject
Private Sub GaugesGroup_DblClick()
MsgBox "Hello from " & GaugesGroup.Name
End Sub


Avi


  #9   Report Post  
Posted to microsoft.public.excel.programming
avi avi is offline
external usenet poster
 
Posts: 195
Default DoubleClick on embedded object(shape)

On 30 août, 15:25, "Jon Peltier"
wrote:
Try this:

Set Gauges(GaugeCount).GaugesGroup = Gauge.Object

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

"avi" wrote in message

ups.com...



Thanks for you help, but still don't know how to solve completely.
I have created a collection of the objects (a Gauge object activeX)
that work fine, but do not know how to associate the event DblClick
with its members. The ActiveX itself has this Event


Dim MyCollection As New Collection
Dim Gauges() As New Class1
Public i As Integer
Sub CollectionGauges()
Dim GaugeCount As Integer
Dim Gauge As OLEObject
GaugeCount = 0


For Each Gauge In ActiveSheet.OLEObjects
MyCollection.Add Gauge


GaugeCount = GaugeCount + 1
ReDim Preserve Gauges(1 To GaugeCount)
Set Gauges(GaugeCount).GaugesGroup = Gauge 'This line
return an error
Next


MsgBox ActiveSheet.OLEObjects(8).Object.Value 'This indeed
return the Value associate witj the ActiveX gauge


End Sub


The Class1 code is:


I have created Class1 but get an error message. I guess that I have to
create a Class and associate a DblClick event whith it but do not know
what kind of class to create. Should it be a collection?


Public WithEvents GaugesGroup As OLEObject
Private Sub GaugesGroup_DblClick()
MsgBox "Hello from " & GaugesGroup.Name
End Sub


Any guidance would help me a lot
Thanks again
Avi- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -


Hello, Jon

Could you help me further?

When i DbleClick the object, the msgBox dispays its name attribute

But how i could use this same name in a UserForm that i open as a part
of the dbleClickEvent?

I've added a Public statement in the Class, but nothing happens

Thanks alot
Avi





  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default DoubleClick on embedded object(shape)

Ah, now you want to do something practical!

In the userform code module, add a module-level variable in the Declarations
section:

Private msControlName As String

Also add a property to the userform:

Public Property Let ControlName(sControlName As String)
msControlName = sControlName
' now make whatever use of the value that you need, for example
me.lblControlName.Caption = msControlName
End Property

In the DoubleClick event procedure in the event class module, load the form,
pass the control name to the form, then show the form:

Public WithEvents GaugesGroup As OLEObject
Private Sub GaugesGroup_DblClick()
Load MyUserForm
With MyUserForm
.ControlName = GaugesGroup.Name
.Show
End With
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"avi" wrote in message
ups.com...
On 30 août, 15:25, "Jon Peltier"
wrote:
Try this:

Set Gauges(GaugeCount).GaugesGroup = Gauge.Object

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

"avi" wrote in message

ups.com...



Thanks for you help, but still don't know how to solve completely.
I have created a collection of the objects (a Gauge object activeX)
that work fine, but do not know how to associate the event DblClick
with its members. The ActiveX itself has this Event


Dim MyCollection As New Collection
Dim Gauges() As New Class1
Public i As Integer
Sub CollectionGauges()
Dim GaugeCount As Integer
Dim Gauge As OLEObject
GaugeCount = 0


For Each Gauge In ActiveSheet.OLEObjects
MyCollection.Add Gauge


GaugeCount = GaugeCount + 1
ReDim Preserve Gauges(1 To GaugeCount)
Set Gauges(GaugeCount).GaugesGroup = Gauge 'This line
return an error
Next


MsgBox ActiveSheet.OLEObjects(8).Object.Value 'This indeed
return the Value associate witj the ActiveX gauge


End Sub


The Class1 code is:


I have created Class1 but get an error message. I guess that I have to
create a Class and associate a DblClick event whith it but do not know
what kind of class to create. Should it be a collection?


Public WithEvents GaugesGroup As OLEObject
Private Sub GaugesGroup_DblClick()
MsgBox "Hello from " & GaugesGroup.Name
End Sub


Any guidance would help me a lot
Thanks again
Avi- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -


Hello, Jon

Could you help me further?

When i DbleClick the object, the msgBox dispays its name attribute

But how i could use this same name in a UserForm that i open as a part
of the dbleClickEvent?

I've added a Public statement in the Class, but nothing happens

Thanks alot
Avi








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OleObject really embedded in cell - not as shape overlay Jon Peltier Excel Programming 1 December 20th 06 01:40 PM
shape object on a userform? Alan Ibbotson Excel Programming 5 April 25th 05 01:24 PM
How to tell wich object/shape was clicked Andrew Ofthesong Excel Programming 2 December 1st 03 05:05 PM
XL2000: Shape object events GSQUARED Excel Programming 1 October 22nd 03 05:15 PM
Hyperlink within the TextFrame of Shape Object..? Robert Stober Excel Programming 0 October 12th 03 10:05 PM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"