ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Too slow testing (https://www.excelbanter.com/excel-programming/330869-too-slow-testing.html)

Liedson31

Too slow testing
 
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

Don Guillett[_4_]

Too slow testing
 
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

--
Don Guillett
SalesAid Software

"Liedson31" wrote in message
...
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




Damien McBain[_2_]

Too slow testing
 
"Liedson31" wrote in message
...
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

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






All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com