Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combobox Question | Excel Programming | |||
ComboBox Question | Excel Programming | |||
Combobox question | Excel Programming | |||
combobox question | Excel Programming | |||
combobox question | Excel Programming |