control on a user form to choose a worksheet

D

dovrox

In a user form - I need to place a control that lists all of the xl
files in a folder so that I can select one file to get informatio
from.

What kind of a control is it and can I see if the xls file is currentl
open by anyone else on the network
 
D

DNF Karran

The control to use would be a list box or combo box populated by loopin
through the file names in the required directory. You could also us
the open dialogue.

You can check if an excel file is open with:

Private Function WorkbookIsOpen(wbname) as Boolean
'Returns TRUE if the workbook is open
Dim x As Workbook
On Error Resume Next
Set x = Workbooks(wbname)
If Err = 0 then WorkbookIsOpen = True _
Else WorkbookIsOpen = False
End Function

(from John Walkenbach)

Dunca
 
Top