Too slow testing

G

Guest

hi everyone...
i have a little problem..
i´m testing if a workbooks exists and then if he is already open...the
problem is my application lose about 20 seconds with this test.
is there any other way for this test that gives me some more speed?

what i do is this:
If (fs.FileExists(wb) = True) Then
If IsOpen = True Then 'a function that tests if the workbook is already
open
Workbooks(wb).Close SAVECHANGES:=False
End If
Workbooks.Open Filename:= wb
end if

thanks in advance
Miguel
 
D

Don Guillett

try this idea I use from a double click event where the file name is typed
in a cell.

Sub GetWorkbook()
If ActiveCell.Value = "" Then Exit Sub
workbookname = ActiveCell.Value
On Error GoTo OpenWorkbook
Windows(workbookname & ".xls").Activate
Exit Sub
OpenWorkbook:
Workbooks.Open(workbookname & ".xls").RunAutoMacros xlAutoOpen
End Sub
 
D

Damien McBain

Liedson31 said:
hi everyone...
i have a little problem..
i´m testing if a workbooks exists and then if he is already open...the
problem is my application lose about 20 seconds with this test.
is there any other way for this test that gives me some more speed?

what i do is this:
If (fs.FileExists(wb) = True) Then

If Not CBool(Len(Dir("[name and path of file]"))) Then
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top