Advertisement

12.21.2005 at 03:21PM PST, ID: 21672589
[x]
Attachment Details

Excel VBA: How to use arrays in classes?

Asked by jrram in Microsoft Excel Spreadsheet Software

Tags: vba, array, class, excel

Here's my class module:

== Original Class Module ==

Option Explicit

Private m_parts(4) As String

When I compile it, I get this error:

"Compile error:
Constants, fixed-lengths, arrays, user-defined types and Declare statements not allowed as Public members of object modules"

When I go to the Excel help, I get this:

"You declared a Public array in an object module.
Although a procedure can't return an array, it can return a Variant that contains an array. To simulate a Public array in a class module, use a set of Property procedures that accept and return a Variant containing an array."

The question is,

How do I accomplish this?  I'm not that familiar with the Variant or get / let / set commands.  I need to be able to use arrays my program.Start Free Trial
 
Loading Advertisement...
 
[+][-]12.21.2005 at 03:23PM PST, ID: 15530812

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.21.2005 at 03:26PM PST, ID: 15530829

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12.21.2005 at 04:34PM PST, ID: 15531163

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.21.2005 at 04:49PM PST, ID: 15531214

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12.21.2005 at 08:11PM PST, ID: 15531829

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: vba, array, class, excel
Sign Up Now!
Solution Provided By: zorvek
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32