In response to your comment
Quote:
Still i want to ask. Is there is some logical or other issue in code.
You are using Excel/Office 2016 so you should be using .xlsx files and not the old style .xls. Excel will still open the files, but in Compatibility Mode.
The code
If xlWorkBook.Sheets.Count() < 1 Then
is not relevant - either the log file already exists - in which case it already has a Worksheet "Log Sheet" or you created a new Workbook with
xlWorkBook = xlapp.workbooks.add()
In the latter case, Excel will have automatically created a worksheet called "Sheet1" - which you will want to
rename to "Log Sheet". Every workbook has to have at least one visible worksheet so your
If
statement will never be true