Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Getting the workbook number via VBA code

Hello ladies and gentleman,

I am stuck with a problem and wondering if someome could help me to
figure it out.

What I want to do is to be able to grab the workbook number from a user
that may have multiple workbooks open at one time.

For example, lets say that a user has workbook1, workbook2 workbook3,
workbook4, and workbook5 open. If you go to the Window Menu, you will
see that it looks like:

1 - workbook1
2 - workbook2
etc...

What I need to grab is the workbook number and place it in my code so I
can call it:

strWorkbookName = Workbooks(Workbooks.Count).Name

I thought that this would bring up the latest workbook that was opened,
but this doesn't seem to be the case.

Any ideas?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Getting the workbook number via VBA code

Do you have any hidden workbooks open (eg. personal.xls) ?

Tim

--
Tim Williams
Palo Alto, CA


"EAB1977" wrote in message
ups.com...
Hello ladies and gentleman,

I am stuck with a problem and wondering if someome could help me to
figure it out.

What I want to do is to be able to grab the workbook number from a user
that may have multiple workbooks open at one time.

For example, lets say that a user has workbook1, workbook2 workbook3,
workbook4, and workbook5 open. If you go to the Window Menu, you will
see that it looks like:

1 - workbook1
2 - workbook2
etc...

What I need to grab is the workbook number and place it in my code so I
can call it:

strWorkbookName = Workbooks(Workbooks.Count).Name

I thought that this would bring up the latest workbook that was opened,
but this doesn't seem to be the case.

Any ideas?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting the workbook number via VBA code


Hello EAB1977,

You were close. To get all the Workbooks the user has open and stor
them in an array...


Dim strWorkbookName()

ReDim strWorkbooName(Workbooks.Count)

For I = 1 To Workbooks.Count
strWorkbookName(I) = Workbooks(I).Name
Next I

Use ActiveWorkbook.Name to return the current Workbook that the use
is in.

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47961

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
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
Code in one workbook to call code in another XL file [email protected] Excel Programming 2 August 1st 05 03:37 PM
Place code from current workbook to new workbook Qaspec Excel Programming 5 June 8th 05 04:12 AM
Reference code in another workbook from a calling workbook Datasort Excel Programming 1 January 4th 05 01:13 AM


All times are GMT +1. The time now is 06:35 PM.

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"