LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
JRB JRB is offline
external usenet poster
 
Posts: 12
Default ComboBox RowSouce Question

Many thanks for the response Tom, I had already used Chip's solution ... but
I will work through your's as well

Thanks again - this is a remarkable group - Long may it flourish

Jim Burton

"Tom Ogilvy" wrote in message
...
Dim NLArray() as String

NLDir = ThisWorkbook.Path & "\NewsLetters\"

NL = Dir(NLDir & "*.pdf")
Redim NLArray(1 to 1)
NLArray(1) = NL

Do While NL < ""
NL = Dir
Redim Preserve NLArray(1 to ubound(NLArray)+1)
NLArray(ubound(NLArray)) = NL
Loop
Userform1.Combobox1.List = NLArray

you would not set the rowsource unless you wanted to put the array on the
worksheet first. Then it would be

set rng =
Worksheets("Sheet1").Resize(Ubound(NLArray)-Lbound(NLArray)+1,1)
rng.Value = Application.Transpose(NLArray)
Useform1.Combobox1.RowSource = rng.Address(1,1,xlA1,True)


Your approach actually builds a string - not an array. You could go that
direction and use split to make it into an array.


Dim NLArray variant
Dim s as String

NLDir = ThisWorkbook.Path & "\NewsLetters\"

NL = Dir(NLDir & "*.pdf")
s = NL

Do While NL < ""
NL = Dir
s = s & ", " & NL
Loop

NLArray = Split(s,",")

set rng =
Worksheets("Sheet1").Resize(Ubound(NLArray)-Lbound(NLArray)+1,1)
rng.Value = Application.Transpose(NLArray)
Useform1.Combobox1.RowSource = rng.Address(1,1,xlA1,True)

or

Userform1.Combobox1.List = NLArray

--
Regards,
Tom Ogilvy


"JRB @eclipse.co.uk" <sa3214<nospam wrote in message
...
I've now managed to populate an array with the filenames using the
following code:

Dim NLArray

NLDir = ThisWorkbook.Path & "\NewsLetters\"

NL = Dir(NLDir & "*.pdf")
NLArray = NL

Do While NL < ""
NL = Dir
NLArray = NLArray & ", " & NL
Loop

I now require to use the contents of the array as the RowSource of a
ComboBox

How do I achieve this ?

Regards and TIA








 
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
Combobox Question Lotus123[_4_] Excel Programming 1 August 3rd 06 10:43 PM
ComboBox Question Duncan Edment Excel Programming 1 August 1st 06 12:42 PM
Combobox question mrdata[_32_] Excel Programming 0 July 18th 06 10:37 PM
combobox question Giselle[_2_] Excel Programming 1 February 19th 06 06:06 PM
combobox question Bri[_3_] Excel Programming 0 February 18th 06 02:51 PM


All times are GMT +1. The time now is 05:04 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"