You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Brendon edited this page Mar 17, 2024
·
1 revision
GetDataTableFromRange
returns cDataTable
accepts (rngIn As Object)
Use this method to convert your Excel data block into a cDataTable object.
In Excel you can pass a Range object, or Selection if you have a range selected, and your data will be transfered into a cDataTable object.
Your data must be at least 2 lines long, allowing for a header row, which is where ExcelDataSet gets your field names from, as well as a data row.
If there is any sort of error encountered in the method, it skips out on a general error handler and returns Nothing
Example
Set ws = wb.Worksheets.Add
ws.Name = "DemoDataFactoryExcel"
Set d = DemoDataFactoryExcel
Set objrange = f.InsertDataTableToCell(Selection, d)
Set d = f.GetDataTableFromRange(objrange)
Set objrange = objrange.Offset(0, 10)
f.InsertDataTableToCell objrange, d