Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default ThisChart function similar to ThisWorkbook (XL2003)

Is there a way to programatically determine a chart object's name when
it's not active? ThisWorkbook provides access to the name of the
workbook that contains the code without it having to be the active
workbook. I would like to be able to get the name of the chart object
that contains the macro code even when it's not the active chart.

I have a macro that I want to use as a template to copy to a chart
object's code page that will only run if that chart is active. I'm
trying to get around having to change the chart name in the code every
time I copy it to a new chart object.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default ThisChart function similar to ThisWorkbook (XL2003)

'ThisWorkbook' is just the default code name for the Workbook object. It
rarely works in my applications because I change it to something more
meaningful.

If the code exists in the Chart sheet's code module, you can use "Me"

Private Sub Chart_Activate()
MsgBox Me.Name
End Sub




In article
,
wrote:

Is there a way to programatically determine a chart object's name when
it's not active? ThisWorkbook provides access to the name of the
workbook that contains the code without it having to be the active
workbook. I would like to be able to get the name of the chart object
that contains the macro code even when it's not the active chart.

I have a macro that I want to use as a template to copy to a chart
object's code page that will only run if that chart is active. I'm
trying to get around having to change the chart name in the code every
time I copy it to a new chart object.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default ThisChart function similar to ThisWorkbook (XL2003)

That's exactly what I needed. I thought that "Me" was for within Class
definitions.

On Jan 3, 10:25 am, JE McGimpsey wrote:
'ThisWorkbook' is just the default code name for the Workbook object. It
rarely works in my applications because I change it to something more
meaningful.

If the code exists in the Chart sheet's code module, you can use "Me"

Private Sub Chart_Activate()
MsgBox Me.Name
End Sub

...

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default ThisChart function similar to ThisWorkbook (XL2003)

The chart sheet's code module is essentially a class module. You can use Me
in a workbook or worksheet code module as well.

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


wrote in message
...
That's exactly what I needed. I thought that "Me" was for within Class
definitions.

On Jan 3, 10:25 am, JE McGimpsey wrote:
'ThisWorkbook' is just the default code name for the Workbook object. It
rarely works in my applications because I change it to something more
meaningful.

If the code exists in the Chart sheet's code module, you can use "Me"

Private Sub Chart_Activate()
MsgBox Me.Name
End Sub

...



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default ThisChart function similar to ThisWorkbook (XL2003)

Hi,

The closest thing would be ActiveChart.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
wrote in message
...
Is there a way to programatically determine a chart object's name when
it's not active? ThisWorkbook provides access to the name of the
workbook that contains the code without it having to be the active
workbook. I would like to be able to get the name of the chart object
that contains the macro code even when it's not the active chart.

I have a macro that I want to use as a template to copy to a chart
object's code page that will only run if that chart is active. I'm
trying to get around having to change the chart name in the code every
time I copy it to a new chart object.




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
A similar =proper function Mcobra41 Excel Discussion (Misc queries) 1 March 8th 05 07:08 PM
Function in xl2003 not working in xl97 Adam Excel Discussion (Misc queries) 2 January 26th 05 03:19 PM
Help with Similar MOD Function Please Paul Black Excel Programming 11 December 5th 04 10:26 PM
Call Private Function from ThisWorkbook module Beto[_3_] Excel Programming 3 February 25th 04 01:36 PM


All times are GMT +1. The time now is 12:39 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"