Getting reference to an OLEObject from another cell?

T

tomerdr

I wonder if a cell can contain a property value of an OLEObject in
another cell?

Assume i have two columns,the first contains OLEObject the second
should contains

OLEObject.Object.Caption


Thanks in advance.
 
N

NickHK

This works, but you should add error handling:

Public Function GetOLEProp(OLEName As String) As String
GetOLEProp = Application.Caller.Parent.OLEObjects(OLEName).Object.Caption
End Function

NickHK
 
T

tomerdr

This works, but you should add error handling:

Public Function GetOLEProp(OLEName As String) As String
GetOLEProp = Application.Caller.Parent.OLEObjects(OLEName).Object.Caption
End Function

NickHK









- Show quoted text -

Thanks it is working...almost...the cell wouldn't update when i am
changing the caption.

Can i force recalculation of a range?

Thanks in advance.
 
N

NickHK

Changing the caption from the properties does not result in a recalculation.
If you are doing it in code, you can call one of the .Calculate methods and
add the .Volatile in the function

Public Function GetOLEProp(OLEName As String) As String
Application.Volatile
GetOLEProp = Application.Caller.Parent.OLEObjects(OLEName).Object.Caption
End Function

NickHK
 

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