Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Combo Source from another file

I am trying to use data from a separate file to populate a ComboBox but am
having trouble. the code is crashing on the follwing statement;
"wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")". Could someone point me in the right
direction please?

Dim Sht As Worksheet
Dim FolderName As String
Dim wb1, wb2 As Workbook

FolderName = "C:\info.xls"

Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open(FolderName)

For Each Sht In wb2.Worksheets
If Sht.Name = "Info" Then
wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")
wb2.Close 'False
Exit For
End If
Next Sht
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Combo Source from another file

Try...

"wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")".Address(Externa l:=True)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Steve"
wrote in message
I am trying to use data from a separate file to populate a ComboBox but am
having trouble. the code is crashing on the follwing statement;
"wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")". Could someone point me in the right
direction please?

Dim Sht As Worksheet
Dim FolderName As String
Dim wb1, wb2 As Workbook
FolderName = "C:\info.xls"
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open(FolderName)
For Each Sht In wb2.Worksheets
If Sht.Name = "Info" Then
wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")
wb2.Close 'False
Exit For
End If
Next Sht
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default Combo Source from another file

Outstanding!!! That did the trick. Thanks Jim

"Jim Cone" wrote:

Try...

"wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")".Address(Externa l:=True)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Steve"
wrote in message
I am trying to use data from a separate file to populate a ComboBox but am
having trouble. the code is crashing on the follwing statement;
"wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")". Could someone point me in the right
direction please?

Dim Sht As Worksheet
Dim FolderName As String
Dim wb1, wb2 As Workbook
FolderName = "C:\info.xls"
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open(FolderName)
For Each Sht In wb2.Worksheets
If Sht.Name = "Info" Then
wb1.Sheets("GUI").ComboBox1.ListFillRange =
wb2.Sheets("Info").Range("A1:A4")
wb2.Close 'False
Exit For
End If
Next Sht

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
How to find/edit combo box source? Gdareos[_2_] New Users to Excel 3 December 20th 08 12:31 PM
Variable row data source for combo boxes? AndyRoo Excel Programming 4 June 2nd 06 09:13 PM
Source code for combo box in form shnim1 Excel Discussion (Misc queries) 1 April 14th 06 04:46 AM
filling combo boxes from single outer source alekm Excel Discussion (Misc queries) 1 February 17th 06 01:49 PM
Need One combo box row source to change based on the value of anot Katie Excel Programming 2 November 22nd 05 11:28 PM


All times are GMT +1. The time now is 03:48 AM.

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

About Us

"It's about Microsoft Excel"