Try using the following code snippet:
' returns TRUE if the workbook is open
Set Excel = Sys.OleObject("Excel.Application")
WorkbookOpen = false
count = Excel.Workbooks.Count
' Iterate through the workbooks collection
' Note that this collection is not zero-based
For i = 1 to count
if (Excel.Workbooks.Item(i).Name = WorkBookName) then
WorkbookOpen = true
MyWorkbookName = "myworkbook.xls"
if (WorkbookOpen(MyWorkbookName)) then
Log.Message("The workbook is open")
Log.Message("The workbook is not open")
Does this help?
Code returns count when the opened workbook name matches with "myworkbook.xls". Do you have a workbook with the name "myworkbook.xls" opened?