LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Class programming - how to return chartobject from a class?

Hi,

I have the following setup:

1. Class module "ChartHandler"
2. Module "Tester"

In ChartHandler, I have a function to return an instance of a
ChartObject. The chart is present in a worksheet in my workbook. I
successfully claim the chart with the following code:

Public Function claimChartObject(ByVal s As String) as ChartObject

Debug.Print ws.Name ' prints worksheet name correctly
Debug.Print ws.ChartObjects(s).Name ' prints the name correctly

claimChartObject = ws.ChartObjects(s)

End Function

The above function works as it should. However, when I try to get the
chartobject from my module, it fails. The code in my module is
something like this:

Dim coChart As ChartObject
Dim handler As ChartHandler ' Creates an instance of ChartHandler -
works

' Some initialization...
' ....

Set coChart = handler.claimChartObject("myChart") ' <-- this fails!

If I try to snatch the chartobject with the following line, it works:
Set coChart = Worksheets("chart").ChartObjects("myChart")

So my question is, how to I return the chartobject from the class?? I
tried changing "Public Function" to "Property Get" but without success.

Any help much appreciated!

Fredrik

 
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
Class modules: parametrize class object fields Jean-Pierre Bidon Excel Programming 11 August 31st 06 02:49 PM
VBA Class Modules Drakey Excel Programming 1 August 28th 06 09:21 PM
class module programming? KR Excel Programming 1 July 18th 06 03:16 AM
Class within a class Josh Rolfe Excel Programming 7 January 29th 06 07:17 PM
RaiseEvent from a class contained in a 2nd class collection? Andrew[_16_] Excel Programming 2 January 6th 04 04:22 PM


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