MacXL: Run-Time Error When You Set RowSource Property (175795)



The information in this article applies to:

  • Microsoft Excel 2001 for Mac
  • Microsoft Excel 98 Macintosh Edition

This article was previously published under Q175795

SYMPTOMS

When you run a Visual Basic for Applications macro, you may receive the following error message:
Run-time error '380:'
Could not set the RowSource property. Invalid property value.

CAUSE

This error occurs when you attempt to programmatically set the RowSource property of a ListBox or ComboBox control on a user form.

The RowSource property is not available in the versions of Microsoft Excel listed at the beginning of this article.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To work around this behavior, store the values in a worksheet, and then use a Visual Basic for Applications procedure to populate the control.

The following example adds values that are stored on a worksheet to a ListBox or ComboBox control on a user form:
  1. Save and close any open workbooks and create a new workbook.
  2. Enter the following values into Sheet1:
          A1: Item1
          A2: Item2
          A3: Item3
          A4: Item4
    					
  3. Start the Visual Basic Editor (press OPTION+F11).
  4. On the Insert menu, click UserForm.
  5. Click ListBox in the Toolbox, and draw a list box on the user form.
  6. Double-click the user form to open the Code window for the user form.
  7. Type the following code into the module sheet:
    Private Sub UserForm_Initialize()
    
       ListBox1.List = Worksheets("Sheet1").Range("A1:A5").Value
    
    End Sub
    					
  8. Run the user form.
The ListBox control is populated with the values from Sheet1.

REFERENCES

For more information about using the ListBox control, in the Visual Basic Editor, click the Office Assistant, type listbox control, click Search, and then click to view the topic

For more information about using the ComboBox control, in the Visual Basic Editor, click the Office Assistant, type combobox control, click Search, and then click a topic to view it.

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar.

Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbprb kbProgramming KB175795