Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default listbox getting error 380 cannot set the rowsource property

I'm trying to set the rowsource for a listbox to use a named range in a
workbook that's external to the workbook where the listbox is defined.

Dim wb As Workbook
Set wb = Workbooks("Budget Account Table.xls")
lbPAAccount.RowSource = wb.Names("AccountAbbrev").RefersTo

The "Budget Account Table.xls" is open in the current workspace. Do I also
need to
Activate "Budget Account Table.xls"?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default listbox getting error 380 cannot set the rowsource property

I'd try:

lbPAAccount.RowSource _
= wb.Names("AccountAbbrev").RefersToRange.address(ex ternal:=true)



cellist wrote:

I'm trying to set the rowsource for a listbox to use a named range in a
workbook that's external to the workbook where the listbox is defined.

Dim wb As Workbook
Set wb = Workbooks("Budget Account Table.xls")
lbPAAccount.RowSource = wb.Names("AccountAbbrev").RefersTo

The "Budget Account Table.xls" is open in the current workspace. Do I also
need to
Activate "Budget Account Table.xls"?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default listbox getting error 380 cannot set the rowsource property

Dave, thanks for your reply.

Your suggestion initially failed in the same manner as my original code. The
problem with both was that I did not have the "Budget Account Table.xls"
open. I was under the impression that EXCEL would automatically open the file
when I did the RefersTo, but that apparently is not the case.

As long as I manually open "Budget Account Table.xls", both forms of the
RefersTo work. I also added wb.Activate; not certain whether that is
necessary.

To avoid having to remember to do the manual open, I saved the workspace and
can open the workspace instead of opening the main workbook. This is OK, but
I'd rather be able to open the main workbook and not have to manually open
the "Budget Account Table.xls" workbook. (I'm going to open a new topic for
that question.)

Phil

"Dave Peterson" wrote:

I'd try:

lbPAAccount.RowSource _
= wb.Names("AccountAbbrev").RefersToRange.address(ex ternal:=true)



cellist wrote:

I'm trying to set the rowsource for a listbox to use a named range in a
workbook that's external to the workbook where the listbox is defined.

Dim wb As Workbook
Set wb = Workbooks("Budget Account Table.xls")
lbPAAccount.RowSource = wb.Names("AccountAbbrev").RefersTo

The "Budget Account Table.xls" is open in the current workspace. Do I also
need to
Activate "Budget Account Table.xls"?


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RowSource in Property Dialog Geoff Excel Programming 2 March 27th 06 12:07 AM
Rowsource Property Mohan Excel Programming 2 February 14th 05 07:41 PM
Runtime error 380: Could not set the List property. invalid property value of listbox jasgrand Excel Programming 0 October 6th 04 09:28 PM
Could not set the RowSource property Tom Ogilvy Excel Programming 0 August 17th 04 07:48 PM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM


All times are GMT +1. The time now is 09:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"