Re: a question in VB6

From: Howard Kaikow (kaikow_at_standards.com)
Date: 03/14/04


Date: Sat, 13 Mar 2004 18:42:33 -0500

In a module

Public Bagels() as Long

Public Sub Bagels()
    ReDim Bagels(200)
' Do whatever

 ' If needed to add elements and preserve existing elements
    ReDim Preserve Bagels(whatever)

Check online Help for ReDim statement.

-- 
http://www.standards.com/; See Howard Kaikow's web site.
"Basel Saba" <bg-saba@scs-net.org> wrote in message
news:c99d4f3e.0403130327.201190ad@posting.google.com...
> "Old Enough to Know Better" <SpamSucks@NoSpam.com> wrote in message
news:<HHu4c.2840$P45.2354@fe1.columbus.rr.com>...
> > "Basel Saba" <bg-saba@scs-net.org> wrote in message
> > news:c99d4f3e.0403121657.450a46c9@posting.google.com...
> > > how can I define an array with varient dimension, so that the
> > > dimensions will be defined later by the user of the program.
> >
> > if by "varient" you mean variable or dynamic
> > Dim myArr() as integer
> > .....
> > Private sub xyz()
> > Redim myArr(500)
> > .....
> > end sub
> >
> > Also lookup(msdn or google) the Preserve keyword if you need to maintain
> > data as you grow your array.
> >
> >
> > if by "varient"  you mean variant well that's another story.
> >
> > -
> > Cheers
>
> Thanks a lot for your help
> But I want to declare my array in a module as a global array
> What is the keyword I have to use


Relevant Pages

  • Re: ReDim not working as expected. Array expert needed.
    ... I next told you not to redim it. ... examples of how array dimensions work in VBA. ... Sub ArrayStudies14() ... Dim MyArray As Variant ' Declare nonarray variant. ...
    (microsoft.public.excel.programming)
  • Re: ReDim not working as expected. Array expert needed.
    ... Dim MyArray As Variant ... Don't redim it prior to populating it, because VBA does that anyway, using ... array comes out dimensioned as ... In Sub ArrayStudies1, MyArray is dimensioned as an array of type ...
    (microsoft.public.excel.programming)
  • Re: ReDim not working as expected. Array expert needed.
    ... Dim MyArray As Variant ... Don't redim it prior to populating it, because VBA does that anyway, using ... array comes out dimensioned as ... In Sub ArrayStudies1, MyArray is dimensioned as an array of type ...
    (microsoft.public.excel.programming)
  • Re: How do I Create ragged arrays in Excel VBA?
    ... I disagree with John's description of references in this instance. ... array B - a reference which won't be removed until *A* is ... Sub RaggedArray() ... ReDim A ...
    (microsoft.public.excel.programming)
  • Re: Updated datestamp doesnt work
    ... Public Sub StoreMyOldVals ... ' store values of current row in array ... Dim dbs As DAO.Database, rst As DAO.Recordset ... Dim var As Variant ...
    (microsoft.public.access.gettingstarted)