Sub PrePopulate()
On Error GoTo errHandler
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
Set MyPresentation = Presentations(1)
Set objWorkbook = objExcel.Workbooks.Open(MyPresentation.Path & "/" & LOCALXLAPATHNAME)
'Runs excel procedure to pull in data from DB
objExcel.Run "GetData"
'Pulls in data from excel and populates the listbox
'This is where I would like to change the code so that it pulls in the row source data from excel.
Set objWorksheet = objWorkbook.Worksheets("Funds")
frmDimPres.lbFunds.Clear
For Each rngItem In objWorksheet.Range("dnrFundListlabel")
frmDimPres.lbFunds.AddItem (rngItem.Text)
Next rngItem
errHandler:
End Sub
|