F
Filips Benoit
Dear All,
W2000
Office2000
Access-application that manages quotations (= excel-files)
In a sub I change some values in an excel-file and close like this (see
code-end below)
.......
xlApp.Visible = False
........
Set WS = Nothing
WB.Close SaveChanges:=True
Set WB = Nothing
xlApp.Quit
Set xlApp = Nothing
Exit sub
This workes OK, BUT while re-opening this file or another I test if Excel is
running to prevent that several quotations are open at the same time.
Although there is no excel-file active the function IsExcelRunningNow()
returns TRUE
Where is the mistake?
THANKS³,
Filip
Function IsExcelRunningNow() As Boolean
Dim MyXL As Object ' Variable to hold reference to Microsoft Excel.
On Error Resume Next ' Defer error trapping.
IsExcelRunningNow = True
Set MyXL = GetObject(, "Excel.Application")
If Err.Number <> 0 Then IsExcelRunningNow = False
Err.Clear ' Clear Err object in case error occurred.
Set MyXL = Nothing ' Release reference to the application and
spreadsheet.
End Function
W2000
Office2000
Access-application that manages quotations (= excel-files)
In a sub I change some values in an excel-file and close like this (see
code-end below)
.......
xlApp.Visible = False
........
Set WS = Nothing
WB.Close SaveChanges:=True
Set WB = Nothing
xlApp.Quit
Set xlApp = Nothing
Exit sub
This workes OK, BUT while re-opening this file or another I test if Excel is
running to prevent that several quotations are open at the same time.
Although there is no excel-file active the function IsExcelRunningNow()
returns TRUE
Where is the mistake?
THANKS³,
Filip
Function IsExcelRunningNow() As Boolean
Dim MyXL As Object ' Variable to hold reference to Microsoft Excel.
On Error Resume Next ' Defer error trapping.
IsExcelRunningNow = True
Set MyXL = GetObject(, "Excel.Application")
If Err.Number <> 0 Then IsExcelRunningNow = False
Err.Clear ' Clear Err object in case error occurred.
Set MyXL = Nothing ' Release reference to the application and
spreadsheet.
End Function