B
Bre-x
Hi,
I have this function that allows me to check if a sheet exits on a specific
workbook. It works fine but i have a problem closing ms excel
It still running on my task window. Thank you all.
Bre-x
Function WorksheetExist(TF As String) As Boolean
Dim objXL As Object
TheFile = TF
Set objXL = CreateObject("Excel.Application")
With objXL.Application
.Visible = False
.Workbooks.Open TheFile
Dim ws, wsName
wsName = "Main"
For Each ws In .Worksheets
If UCase(ws.Name) = UCase(wsName) Then
WorksheetExist = True
.Workbooks.Close
.Quit
Exit Function
End If
Next
WorksheetExist = False
.Workbooks.Close
.Quit
End With
Set objSht = Nothing
Set objXL = Nothing
End Function
I have this function that allows me to check if a sheet exits on a specific
workbook. It works fine but i have a problem closing ms excel
It still running on my task window. Thank you all.
Bre-x
Function WorksheetExist(TF As String) As Boolean
Dim objXL As Object
TheFile = TF
Set objXL = CreateObject("Excel.Application")
With objXL.Application
.Visible = False
.Workbooks.Open TheFile
Dim ws, wsName
wsName = "Main"
For Each ws In .Worksheets
If UCase(ws.Name) = UCase(wsName) Then
WorksheetExist = True
.Workbooks.Close
.Quit
Exit Function
End If
Next
WorksheetExist = False
.Workbooks.Close
.Quit
End With
Set objSht = Nothing
Set objXL = Nothing
End Function