+ Reply to Thread
Results 1 to 3 of 3

object pointers

  1. #1
    Registered User
    Join Date
    10-24-2005
    Posts
    1

    object pointers

    I'm new to VBA. I'm trying to make an object pointer so I can dynamically populate some ComboBoxes. Here is what doesn't work:

    Please Login or Register  to view this content.
    I've tryed switching data types with "as object" with no luck. Searching for this on the web is crazy. It seems everyone wants some pointers on using excel.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Rando4,

    Neither Visual Basic nor Visual Basic for Applications use object pointers in the traditional sense of a pointer. I have made the changes to the code to do what you want.

    By the way, do you want all for ComboBoxes to be filled with the same range data?


    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Tom Ogilvy
    Guest

    Re: object pointers

    Public Sub showForm()
    Dim a as Object
    For i = 1 To 4
    set a = Userform1.Controls("Combobox" & i)
    a.ColumnCount = 1
    a.RowSource = "Sheet1!A2:A11"
    Next i
    UserForm1.Show
    End Sub
    --------------------

    --
    Regards,
    Tom Ogilvy

    "rando4" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I'm new to VBA. I'm trying to make an object pointer so I can
    > dynamically populate some ComboBoxes. Here is what doesn't work:
    >
    >
    > Code:
    > --------------------
    > Public Sub showForm()
    > UserForm1.Show
    > Sheet1.Activate
    >
    > For i = 1 To 4
    > a = "UserForm1.ComboBox" & i
    > a.ColumnCount = 1
    > a.RowSource = "A2:A11"
    > Next i
    >
    > End Sub
    > --------------------
    >
    >
    > I've tryed switching data types with "as object" with no luck.
    > Searching for this on the web is crazy. It seems everyone wants some
    > pointers on using excel.
    >
    >
    > --
    > rando4
    > ------------------------------------------------------------------------
    > rando4's Profile:

    http://www.excelforum.com/member.php...o&userid=28315
    > View this thread: http://www.excelforum.com/showthread...hreadid=478994
    >




+ 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