PC Review


Reply
Thread Tools Rate Thread

Create my own Class Object for Ranges, having trouble assigning name property

 
 
mimiqinc@aol.com
Guest
Posts: n/a
 
      29th Nov 2005
I created a Class called Market_Report.

I then created several instances of Market_Report in a collection
called grMarket_Report_Ranges

Now I am calling the object and was able to set a range to the object
but cannot assign the name property.

grMarket_Report_Ranges is defined as global collection. g is for
global, r is for range.

So the following works:

---code---
Set grMarket_Report_Ranges.Program(iRP_Array_Dimension) =
Worksheets("Calc-Codes").Range("AB7:AB" & Trim(Str(iRow_Unique)))
---code---

The following does not with or w/o a Set statement.:

---code---
grMarket_Report_Ranges.Program(iRP_Array_Dimension).Name = "Market
Report Programs"
---code---

I get a RTE 91, Object variable or with block variable not set

Here is what my class looks like:

'CLASS START -------------------------

Option Explicit

Private mrProgram() As Range

Public Function Initialize(iDimensions As Integer)

ReDim Preserve mrProgram(iDimensions)

End Function

Public Property Get Program(ByVal i As Integer) As Range
Program = mrProgram(i)
End Property

Public Property Set Program(ByVal i As Integer, ByVal r As Range)
Set mrProgram(i) = r
End Property

'CLASS END
------------------------------------------------------------------------------------------

 
Reply With Quote
 
 
 
 
mimiqinc@aol.com
Guest
Posts: n/a
 
      29th Nov 2005
I figured it out but now I'm unclear as to why I created my own class
for this. I wanted all the info to be organized.

The statement I needed to generate was:

Worksheets("Calc-Codes").Range("AB7:AB" & Trim(Str(iRow_Unique))).Name
= "Market Report Programs"

Can anyone explain to me how I can keep my info organized in a
colletion of objects?

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      29th Nov 2005
The name property of what? What exactly are you trying to set here?

--

HTH

RP
(remove nothere from the email address if mailing direct)


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I created a Class called Market_Report.
>
> I then created several instances of Market_Report in a collection
> called grMarket_Report_Ranges
>
> Now I am calling the object and was able to set a range to the object
> but cannot assign the name property.
>
> grMarket_Report_Ranges is defined as global collection. g is for
> global, r is for range.
>
> So the following works:
>
> ---code---
> Set grMarket_Report_Ranges.Program(iRP_Array_Dimension) =
> Worksheets("Calc-Codes").Range("AB7:AB" & Trim(Str(iRow_Unique)))
> ---code---
>
> The following does not with or w/o a Set statement.:
>
> ---code---
> grMarket_Report_Ranges.Program(iRP_Array_Dimension).Name = "Market
> Report Programs"
> ---code---
>
> I get a RTE 91, Object variable or with block variable not set
>
> Here is what my class looks like:
>
> 'CLASS START -------------------------
>
> Option Explicit
>
> Private mrProgram() As Range
>
> Public Function Initialize(iDimensions As Integer)
>
> ReDim Preserve mrProgram(iDimensions)
>
> End Function
>
> Public Property Get Program(ByVal i As Integer) As Range
> Program = mrProgram(i)
> End Property
>
> Public Property Set Program(ByVal i As Integer, ByVal r As Range)
> Set mrProgram(i) = r
> End Property
>
> 'CLASS END
> --------------------------------------------------------------------------

----------------
>



 
Reply With Quote
 
mimiqinc@aol.com
Guest
Posts: n/a
 
      29th Nov 2005
NAME PROPERTY OF BUILT IN RANGE CLASS.

I created a custom class of objects that would juggle a huge amount of
ranges. If you look at the custom class I created it defines a property
of type Range.

 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      29th Nov 2005
Seems like it would be easier to just use a collection. However:

http://tinyurl.com/begok

--
Regards,
Tom Ogilvy


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> NAME PROPERTY OF BUILT IN RANGE CLASS.
>
> I created a custom class of objects that would juggle a huge amount of
> ranges. If you look at the custom class I created it defines a property
> of type Range.
>



 
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
How does one create a delete property of a user defined class? Abraham.Olson@gmail.com Microsoft Excel Programming 6 28th Jun 2006 08:12 PM
Trouble with property DocumentText in WebBrowser class (.Net Framework2) ata Microsoft C# .NET 0 5th Oct 2005 12:41 AM
ToString Property for user-defined class/object Vilem Sova Microsoft VB .NET 1 2nd Oct 2004 05:26 AM
Re: Dynamically Create Property or Member of a Class? Dave Powlin Microsoft Dot NET Framework Forms 0 2nd Apr 2004 09:41 PM
Trouble removing Class Object from Code Editor in Access Lynnette Microsoft Access VBA Modules 1 30th Jun 2003 08:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:05 AM.