There are no direct methods using Exel/Workbook object to find the functionality.
Work around is, we need to find out all open tasks, and from that we will see whether any task with name "Microsoft Excel"
Here in the below code, i have a sample Excel file with name "SampleXL".
Set Word = CreateObject("Word.Application")
Set Tasks = Word.Tasks
i=0
For Each Task in Tasks
If instr(Task.Name,"Microsoft Excel - SampleXL")>0 Then
i=1
end if
Next
If i=1 Then
print "Excel file is opened"
else
print "No excel file opened with the name specified"
End If
Word.Quit
Work around is, we need to find out all open tasks, and from that we will see whether any task with name "Microsoft Excel"
Here in the below code, i have a sample Excel file with name "SampleXL".
Set Word = CreateObject("Word.Application")
Set Tasks = Word.Tasks
i=0
For Each Task in Tasks
If instr(Task.Name,"Microsoft Excel - SampleXL")>0 Then
i=1
end if
Next
If i=1 Then
print "Excel file is opened"
else
print "No excel file opened with the name specified"
End If
Word.Quit
No comments:
Post a Comment