+ Reply to Thread
Results 1 to 5 of 5

is a variant an object

  1. #1
    James Cornthwaite
    Guest

    is a variant an object

    does when assigning a variant need a set statement?

    THanks
    James



  2. #2
    Charlie
    Guest

    RE: is a variant an object

    Only when you are setting it to an object, examples:

    Dim v As Variant
    v = 1.234 'Floating point number
    v = "Hello" 'string
    Set v = Range("a1") 'object


    "James Cornthwaite" wrote:

    > does when assigning a variant need a set statement?
    >
    > THanks
    > James
    >
    >
    >


  3. #3
    Jim Thomlinson
    Guest

    RE: is a variant an object

    A variant is anything it wants to be. It can be an object (requiring the set
    statement), or it can be a regular variable (not requiring the set satement)
    as pointed out by Charlie... That being said try not to use varaints as much
    as possible. They are very inefficient, because everytime that you try to
    access a variant, the system must first try to determine exactly what it
    is... This is a relatively slow process...
    --
    HTH...

    Jim Thomlinson


    "James Cornthwaite" wrote:

    > does when assigning a variant need a set statement?
    >
    > THanks
    > James
    >
    >
    >


  4. #4
    Charlie
    Guest

    RE: is a variant an object

    That's true.

    I have a love-hate relationship with Variants. I was leary of using them at
    first -- I didn't like the concept, nor the system overhead, but they sure
    make programming easy. And I can make more versatile functions using them as
    args.

    "Jim Thomlinson" wrote:

    > A variant is anything it wants to be. It can be an object (requiring the set
    > statement), or it can be a regular variable (not requiring the set satement)
    > as pointed out by Charlie... That being said try not to use varaints as much
    > as possible. They are very inefficient, because everytime that you try to
    > access a variant, the system must first try to determine exactly what it
    > is... This is a relatively slow process...
    > --
    > HTH...
    >
    > Jim Thomlinson
    >
    >
    > "James Cornthwaite" wrote:
    >
    > > does when assigning a variant need a set statement?
    > >
    > > THanks
    > > James
    > >
    > >
    > >


  5. #5
    Dave Peterson
    Guest

    Re: is a variant an object

    I find that if I declare my object variables as specific objects:

    Dim wks as worksheet
    instead of
    dim wks as variant

    Then I get the added benefit of the VBE's autocomplete.

    I type: wks. (with that dot) and then the VBE pops up all options that I can
    choose from.

    I find specific declarations make program easy, er, less difficult <bg>.

    Charlie wrote:
    >
    > That's true.
    >
    > I have a love-hate relationship with Variants. I was leary of using them at
    > first -- I didn't like the concept, nor the system overhead, but they sure
    > make programming easy. And I can make more versatile functions using them as
    > args.
    >
    > "Jim Thomlinson" wrote:
    >
    > > A variant is anything it wants to be. It can be an object (requiring the set
    > > statement), or it can be a regular variable (not requiring the set satement)
    > > as pointed out by Charlie... That being said try not to use varaints as much
    > > as possible. They are very inefficient, because everytime that you try to
    > > access a variant, the system must first try to determine exactly what it
    > > is... This is a relatively slow process...
    > > --
    > > HTH...
    > >
    > > Jim Thomlinson
    > >
    > >
    > > "James Cornthwaite" wrote:
    > >
    > > > does when assigning a variant need a set statement?
    > > >
    > > > THanks
    > > > James
    > > >
    > > >
    > > >


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1