+ Reply to Thread
Results 1 to 3 of 3

What do [brackets] mean in VBA?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    142

    What do [brackets] mean in VBA?

    Hi all

    I get the impression that the use of brackets [such as this] in VBA code is shorthand to produce the same compiled effect as an alternative more verbose (but possibly to me easier to understand) coding.
    Example
    Private Sub UserForm_Initialize()
        Me.ComboBox1.List = [MyArray]
    End Sub
    Could someone please re-write the above code without using the bracketed syntax, just so that I can understand the effect of that syntax?

    Thanks
    Last edited by 1eyedjack; 02-22-2010 at 04:53 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: What do [brackets] mean in VBA?

    The brackets are a shortcut to the VBA Evaluate function. They look nice and compact, but when Evaluate is not needed, just add a function where none is necessary.

    Me.ComboBox1.List = Range("MyArray").Value
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    11-14-2007
    Posts
    142

    Re: What do [brackets] mean in VBA?

    Thanks - just what I needed to know

+ 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