Cannot close WorkBooks ...
I tried other ways of closing it, but it is still in the Tast Manager ...
It opens it up and that's it ... how the hell do I close it
I use Microsoft Excel 11.0 Lib.
here is the code
VB Code:
Public Sub Check_Validity2()
On Error GoTo NoFile
Set myBook = Workbooks.Open(strMainFilePath)
exists = myBook.Worksheets("AH Data").Cells(1, 3).Value
If exists = "AH1 (AH09-01)" Then
exists = "true"
Else: exists = ""
End If
myBook.Close savechanges:=False
NoFile:
If Err.Number = 9 Then
myBook.Close
exists = ""
End If
End Sub
Re: Cannot close WorkBooks ...
I take it that this is entirely in Excel. So, you are wanting to close the workbook AND close Excel.
This will close the Excel application if you have already closed the workbook.
After you close the workbook you need to destroy the workbook object.
VB Code:
myBook.Close
Set mybook = Nothing
Application.Quit