View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Find the other workbooks name

hi
here is code that will assign the other workbook name to a variable call wbn.
this will work if you have ONLY 2 workbooks open. if you have a personal or
addin open also, then this will give you problems.
Sub listwb()
Dim wb As Workbook
Dim wbn As String
For Each wb In Application.Workbooks
If wb.Name < ThisWorkbook.Name Then
wbn = wb.Name
MsgBox wbn 'test purposes only
End If
Next wb
End Sub

regards
FSt1

"MarkS" wrote:

Hi,
I have two workbooks open to find the first workbooks name I use
ThisWorkBook.Name to problem is to find the other workbooks name. I need to
copy some data from the second workbook to the first workbook, the name of
the second workbook always changes

Thanks