05-22-2012, 03:00 AM
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