Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to read the contents of external excel sheet
#6
Solved: 10 Years, 9 Months, 3 Weeks ago
Sorry its late, but if you'd prefer to do what you originally wanted this might help:

Code:
Public ref

Function LoadfromExcel(filename)
'Loads values from constantxls file into memory
    Dim objExcel
    Dim objWorkbook
    Set ref = CreateObject("Scripting.Dictionary")
    ref.CompareMode = VBTextCompare    
    Set objExcel = CreateObject("Excel.Application")
    Set objWorkbook = objExcel.Workbooks.Open (filename)
    objExcel.Visible = True
    objExcel.Sheets("Constants").Select
    row = 2 'first data row in xls
    
    'fill dictionary with external constants
    While (objExcel.Cells(row,1).Value<>"")
        ref.Add objExcel.Cells(row,1).Value,objExcel.Cells(row,2).Value
        row = row + 1
    Wend  

    objExcel.quit
End Function
Reply


Messages In This Thread
RE: How to read the contents of external excel sheet - by hammersandnails - 05-22-2012, 03:00 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,601 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  Custom sort -Excel Sheet kiran 1 3,699 01-28-2014, 09:23 AM
Last Post: supputuri
  Can we save an exported Excel sheet directly from QTP? Akhila 2 3,155 11-28-2013, 10:30 AM
Last Post: Akhila
  How to identify the object reference to the existing(already opened) Excel sheet yogeesh 1 9,789 09-26-2012, 07:00 PM
Last Post: krr
  programming to use different external file of environment variables bundfromnj 1 3,723 01-19-2012, 05:32 PM
Last Post: SteveS

Forum Jump:


Users browsing this thread: 1 Guest(s)