Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default userform to display dropdown list of open XL files

I want to create a userform to display 2 dropdown lists, both with all
currently opened XL files in the list, so the user can select 2 files
to compare.

I've tried reverse engineering Chip Pearson's code in his "Compare"
macro, but it's just beyond my current skill level. And I looked for
information in this NG, but couldn't find a solution, probably I just
don't know how to phrase the search criteria correctly.

I have almost no experience with forms in XL, other than creating a
simple form to ask the user for input and put the data in a cell. But I
do know how to create a basic form.

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default userform to display dropdown list of open XL files

Create a userform and add two combo boxs to it. Add this code to the form and
you will get your two combo boxes...

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
Next wbk
End Sub
--
HTH...

Jim Thomlinson


"davegb" wrote:

I want to create a userform to display 2 dropdown lists, both with all
currently opened XL files in the list, so the user can select 2 files
to compare.

I've tried reverse engineering Chip Pearson's code in his "Compare"
macro, but it's just beyond my current skill level. And I looked for
information in this NG, but couldn't find a solution, probably I just
don't know how to phrase the search criteria correctly.

I have almost no experience with forms in XL, other than creating a
simple form to ask the user for input and put the data in a cell. But I
do know how to create a basic form.

Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default userform to display dropdown list of open XL files

You might want to add:

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
if wbk.windows(1).Visible = True then
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
end if
Next wbk
End Sub

This will avoid including workbooks that are hidden.

--
Regards,
Tom Ogilvy


"Jim Thomlinson" wrote in message
...
Create a userform and add two combo boxs to it. Add this code to the form

and
you will get your two combo boxes...

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
Next wbk
End Sub
--
HTH...

Jim Thomlinson


"davegb" wrote:

I want to create a userform to display 2 dropdown lists, both with all
currently opened XL files in the list, so the user can select 2 files
to compare.

I've tried reverse engineering Chip Pearson's code in his "Compare"
macro, but it's just beyond my current skill level. And I looked for
information in this NG, but couldn't find a solution, probably I just
don't know how to phrase the search criteria correctly.

I have almost no experience with forms in XL, other than creating a
simple form to ask the user for input and put the data in a cell. But I
do know how to create a basic form.

Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default userform to display dropdown list of open XL files


Tom Ogilvy wrote:
You might want to add:

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
if wbk.windows(1).Visible = True then
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
end if
Next wbk
End Sub

This will avoid including workbooks that are hidden.

--
Regards,
Tom Ogilvy


Thanks, both of you. I probably should have asked earlier, but how do I
capture the spreadsheet names once they've been selected and the OK
button clicked?



"Jim Thomlinson" wrote in message
...
Create a userform and add two combo boxs to it. Add this code to the form

and
you will get your two combo boxes...

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
Next wbk
End Sub
--
HTH...

Jim Thomlinson


"davegb" wrote:

I want to create a userform to display 2 dropdown lists, both with all
currently opened XL files in the list, so the user can select 2 files
to compare.

I've tried reverse engineering Chip Pearson's code in his "Compare"
macro, but it's just beyond my current skill level. And I looked for
information in this NG, but couldn't find a solution, probably I just
don't know how to phrase the search criteria correctly.

I have almost no experience with forms in XL, other than creating a
simple form to ask the user for input and put the data in a cell. But I
do know how to create a basic form.

Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default userform to display dropdown list of open XL files

My preference is to not unload the form, but just to hide it. Then you can
just referdirectly to the combo boxes somethin like this...

workbooks(combobox1.text).select
--
HTH...

Jim Thomlinson


"davegb" wrote:


Tom Ogilvy wrote:
You might want to add:

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
if wbk.windows(1).Visible = True then
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
end if
Next wbk
End Sub

This will avoid including workbooks that are hidden.

--
Regards,
Tom Ogilvy


Thanks, both of you. I probably should have asked earlier, but how do I
capture the spreadsheet names once they've been selected and the OK
button clicked?



"Jim Thomlinson" wrote in message
...
Create a userform and add two combo boxs to it. Add this code to the form

and
you will get your two combo boxes...

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
Next wbk
End Sub
--
HTH...

Jim Thomlinson


"davegb" wrote:

I want to create a userform to display 2 dropdown lists, both with all
currently opened XL files in the list, so the user can select 2 files
to compare.

I've tried reverse engineering Chip Pearson's code in his "Compare"
macro, but it's just beyond my current skill level. And I looked for
information in this NG, but couldn't find a solution, probably I just
don't know how to phrase the search criteria correctly.

I have almost no experience with forms in XL, other than creating a
simple form to ask the user for input and put the data in a cell. But I
do know how to create a basic form.

Thanks.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default userform to display dropdown list of open XL files


Jim Thomlinson wrote:
My preference is to not unload the form, but just to hide it. Then you can
just referdirectly to the combo boxes somethin like this...

workbooks(combobox1.text).select
--
HTH...

Jim Thomlinson


Thanks to you both!


"davegb" wrote:


Tom Ogilvy wrote:
You might want to add:

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
if wbk.windows(1).Visible = True then
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
end if
Next wbk
End Sub

This will avoid including workbooks that are hidden.

--
Regards,
Tom Ogilvy


Thanks, both of you. I probably should have asked earlier, but how do I
capture the spreadsheet names once they've been selected and the OK
button clicked?



"Jim Thomlinson" wrote in message
...
Create a userform and add two combo boxs to it. Add this code to the form
and
you will get your two combo boxes...

Private Sub UserForm_Initialize()
Dim wbk As Workbook

For Each wbk In Workbooks
ComboBox1.AddItem wbk.Name
ComboBox2.AddItem wbk.Name
Next wbk
End Sub
--
HTH...

Jim Thomlinson


"davegb" wrote:

I want to create a userform to display 2 dropdown lists, both with all
currently opened XL files in the list, so the user can select 2 files
to compare.

I've tried reverse engineering Chip Pearson's code in his "Compare"
macro, but it's just beyond my current skill level. And I looked for
information in this NG, but couldn't find a solution, probably I just
don't know how to phrase the search criteria correctly.

I have almost no experience with forms in XL, other than creating a
simple form to ask the user for input and put the data in a cell. But I
do know how to create a basic form.

Thanks.





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
find files from a dropdown list [email protected] Excel Worksheet Functions 2 February 14th 09 03:11 PM
Excell Dropdown List. Display alternate text than found in list. Shawnn Excel Discussion (Misc queries) 14 December 11th 08 07:43 PM
Dropdown list doesn't display from the top of the list stebro Excel Discussion (Misc queries) 4 June 12th 07 11:15 PM
dropdown list...no help in the help files miketv New Users to Excel 0 May 9th 06 05:34 AM
How do I change the size of font/display in a dropdown list I've . Steve Excel Programming 0 April 8th 05 07:13 PM


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