Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Get a list of open workbooks and choose one

Hello,

I need to get a list of all the workbooks that the user currently has open,
give that list to the user, let them select one, and then Activate that
selected workbook and continue with processing.
I can generate a list of workbooks in a given directory, but the requirement
here is to get a list of workbooks that are currently open.

Many thanks for all your help.
Phil
--
Programmer on Budget
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Get a list of open workbooks and choose one

This is not real fancy but it worked in a test.


Sub chooseWB()
Dim Wb As Workbook, wbNm As String, choice As String
For Each Wb In Application.Workbooks
wbNm = wbNm & Wb.Name & vbCrLf
Next
choice = InputBox("Enter one of the workbooks below:" _
& vbCrLf & wbNm, "CHOOSE A WORKBOOK")
Workbooks(choice).Activate
End Sub




"Budget Programmer" wrote in
message ...
Hello,

I need to get a list of all the workbooks that the user currently has
open,
give that list to the user, let them select one, and then Activate that
selected workbook and continue with processing.
I can generate a list of workbooks in a given directory, but the
requirement
here is to get a list of workbooks that are currently open.

Many thanks for all your help.
Phil
--
Programmer on Budget



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Get a list of open workbooks and choose one

Phil,

Just looking at the currently open workbooks bit:

Sub showBooks()
Dim wb As Workbook
Dim nm As String

For Each wb In Workbooks
nm = wb.Name
Debug.Print nm
Next wb

End Sub


"Budget Programmer" wrote in
message ...
Hello,

I need to get a list of all the workbooks that the user currently has

open,
give that list to the user, let them select one, and then Activate that
selected workbook and continue with processing.
I can generate a list of workbooks in a given directory, but the

requirement
here is to get a list of workbooks that are currently open.

Many thanks for all your help.
Phil
--
Programmer on Budget



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default Get a list of open workbooks and choose one

I think you just want to loop through the Application.Workbooks collection.
Something like this, only maybe you'd want to add them to a listbox control
for selection instead of making a list on the sheet, but just for ease of
demonstration...

Sub WkbList()

Dim R as Long
Dim Wkb as Workbook

R = 1
For Each Wkb in Application.Workbooks
Cells(R, 1) = Wkb.Name
R = R + 1
Next Wkb

End Sub

"Budget Programmer" wrote:

Hello,

I need to get a list of all the workbooks that the user currently has open,
give that list to the user, let them select one, and then Activate that
selected workbook and continue with processing.
I can generate a list of workbooks in a given directory, but the requirement
here is to get a list of workbooks that are currently open.

Many thanks for all your help.
Phil
--
Programmer on Budget

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
List of open workbooks anamarie30 Excel Programming 1 July 30th 07 02:32 PM
Drop-Down List to Choose File to Open tbchief[_2_] Excel Programming 0 May 28th 04 08:22 PM
Drop-Down List to Choose File to Open tbchief Excel Programming 0 May 28th 04 08:14 PM
Getting list of open workbooks [email protected] Excel Programming 7 November 26th 03 09:09 PM
List Open Workbooks in VBA Chip Pearson Excel Programming 1 November 17th 03 05:21 PM


All times are GMT +1. The time now is 07:00 AM.

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"