Forum Discussion
irina_lukina
13 years agoSuper Contributor
Hi Michael,
Try using the following code snippet:
' returns TRUE if the workbook is open
function WorkbookOpen(WorkBookName)
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
end if
Next
end function
sub Main
MyWorkbookName = "myworkbook.xls"
if (WorkbookOpen(MyWorkbookName)) then
Log.Message("The workbook is open")
else
Log.Message("The workbook is not open")
end if
end sub
Does this help?
Related Content
- 12 years agokirk_bottomley
- 3 years agoLarry_M
Recent Discussions
- 11 hours agosimonaferrara
- 20 hours agoSubhraDas