How to use test data from a locked Excel Workbook (QTP, VBScript)
Parent page: Service Functions – Excel (QTP, VBScript)
Question
The question was asked here.
How can I get data from Excel spreadsheet if it is accidentally open? It ruins whole batch execution.
While opening manually I can go “read-only” and still access it.
Is there any way to read data from an open and locked Excel file from QTP?
Answer
You can programmatically open an Excel workbook and check whether it’s accessible as read-only.
If you need to get a full control of Excel data files during a batch execution of scripts I suggest the following logic.
Description
1. Check if Excel Workbook is locked
2. Create a duplicate file
3. Use duplicated file as a data source
4. Delete when you no longer need it
One response to "How to use test data from a locked Excel Workbook (QTP, VBScript)"
Great information! I’ve been looking for something like this for a while now. Thanks!