The applicaiton through which the service is created,
doesnt give that error.
To check the exact issue, I tested with a service
containing this block of code. The service gives the error
when run as local system or even in an account (mine)
For this block of code
Private Sub Timer1_Elapsed(ByVal sender As Object, ByVal e
As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
Dim handle As Integer
errorCount = 1
handle = GetErrorFileHandle
("C:\Temp\ErrorFile.txt")
LogError(0, "Before Try", "Abhi", "Elapsed",
handle)
Try
LogError(0, "Inside Try", "Abhi", "Elapsed",
handle)
Dim obj As New Excel.Application
obj.Visible = True
LogError(0, "before excel
quit", "abhi", "elasped", "handle")
obj.Quit()
obj = Nothing
LogError(0, "Inside Try after
nothing", "Abhi", "Elapsed", handle)
Catch ex As Exception
LogError(0, "Inside Catch", "Abhi", "Elapsed",
handle)
End Try
Timer1.Enabled = False
LogError(0, "End elapsed", "Abhi", "Elapsed",
handle)
FileClose(handle)
handle = Nothing
End Sub
the output was
"04-Sep-2003 08:54:22 | 0 | Before Try | Abhi | Elapsed"
"04-Sep-2003 08:54:22 | 0 | Inside Try | Abhi | Elapsed"
"04-Sep-2003 08:54:22 | 0 | Inside Catch | Abhi | Elapsed"
"04-Sep-2003 08:54:22 | 0 | End elapsed | Abhi | Elapsed
Basically, it throws an error at Dim obj As
New Excel.Application and quits try catch block.
Can someone pinpoint the reason?
TIA
Abhi