Mapping Excel col names (QTP, VBScript)
Original date: 5 Dec 2008, 1:23pm
Parent page: Service Functions – Excel (QTP, VBScript)
'Assumptions: 'Excel file exists 'Workbook is open (XLBook) 'Sheet exists Set objUsedRange = XLBook.Worksheets(sSheetIndex).UsedRange() Set objSheetColNameMap = CreateObject("Scripting.Dictionary") For Iter = 1 To objUsedRange.Columns.Count sCellText = objUsedRange.Cells(1,Iter) If sCellText <> "" Then objSheetColNameMap.Item(sCellText) = Iter End If Next
One response to "Mapping Excel col names (QTP, VBScript)"
Hi Albert,
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?
Thanks,
Lena
[ Albert’s reply: here’s the example. ]