PC Review


Reply
Thread Tools Rate Thread

How can I locate image code in a worksheet object

 
 
JT
Guest
Posts: n/a
 
      23rd Sep 2008
Dear all

I have checked the archives for a solution to this and have drawn a
blank.

I have an image "shpTrend" to which I want to attach the following
code:

Sub shpTrend_Click()

ThisWorkbook.ActiveSheet.Names("dKESelection").RefersToRange.Value =
"Trend uplift / downgrade"
Application.GoTo Reference:="dTrendUplift"

End Sub

This image, and the ranges "dTrendUplift" and "dKESelection" are
replicated on multiple worksheets and I want the code to use the
versions of the ranges that are in the same sheet as the image that
has been clicked.

The most efficient way of doing this, I believe, is to create the
image using control toolbox, and then replicate the code in each of
the relevant worksheet objects in visual basic. However, the image I
want to use already exists and took a long time to create (i.e.
draw). If there is a way of getting an existing image to be
controlled like a control toolbox image then this would save me a lot
of time.

Hopefully somebody can help with this.

Thanks

JT
 
Reply With Quote
 
 
 
 
Héctor Miguel
Guest
Posts: n/a
 
      24th Sep 2008
hi, !

(i guess...) you could try a macro to assign a macro to your shape-object
(i.e.) looping through every worksheet with an instruction like...

ActiveSheet.Shapes("shpTrend").OnAction = "shpTrend_Click"

hth,
hector.

__ OP __
> I have checked the archives for a solution to this and have drawn a blank.
> I have an image "shpTrend" to which I want to attach the following code:
> Sub shpTrend_Click()
> ThisWorkbook.ActiveSheet.Names("dKESelection").RefersToRange.Value = "Trend uplift / downgrade"
> Application.GoTo Reference:="dTrendUplift"
> End Sub
> This image, and the ranges "dTrendUplift" and "dKESelection" arereplicated on multiple worksheets
> and I want the code to use the versions of the ranges that are in the same sheet as the image that has been clicked.
> The most efficient way of doing this, I believe, is to create the image using control toolbox
> and then replicate the code in each of the relevant worksheet objects in visual basic.
> However, the image I want to use already exists and took a long time to create (i.e. draw).
> If there is a way of getting an existing image to be controlled like a control toolbox image then this would save me a lot time.
> Hopefully somebody can help with this...



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto_open from Worksheet Object Code Stuart Microsoft Excel Programming 1 19th Oct 2007 08:00 PM
Image Restore Problem: Can't Locate Image =?Utf-8?B?UGFwdXR4aQ==?= Windows Vista General Discussion 4 13th Jul 2007 11:52 PM
Attach object (eg image) to worksheet usadream Microsoft Excel Programming 3 27th Mar 2006 04:08 PM
how to save an image from a web page to a local folder using code and browser control and doc object news.austin.rr.com Microsoft ASP .NET 1 25th Apr 2005 06:45 AM
Can't locate source of error: Object reference not set to an instance of an object Jim P. Microsoft Dot NET 3 2nd Apr 2004 10:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:01 PM.