Hi,
Could you help me and explain how to output a datatable via interop.
I want to write a simple datatable to a range just like we do it over write range activities but I want to do it via VB.NET code.
Thank you
Hi,
Could you help me and explain how to output a datatable via interop.
I want to write a simple datatable to a range just like we do it over write range activities but I want to do it via VB.NET code.
Thank you
Try this @Petar_Soce,
Dim Z As Integer
Dim y As Integer
For Z = 0 To ws.UsedRange.Columns.Count
ws.Cells(1, Z + 1) = dt.Columns(Z).ColumnName
Next
For Z = 1 To ws.UsedRange.Rows.Count
For y = 1 To ws.UsedRange.Columns.Count
ws.Cells(Z + 1, y + 1) = dt.Rows(Z)(y).ToString
Next
Next
dt is the data table and ws is the worksheet
Thank you. Thought there was just a line like datatabel.add or something like that. Did not wanted to resort to a loop. Thank you !
No way to do that I hope without looping …
Can you explain why you go for using VB instead of the activity? It is just a quite interesting thing i found here today
I have to delete some sheets after and autofit etc. Seemed simpiler to do it over VB than to use multiple activities and open/close my excel workbook each time.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.