Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you, all of you, for helping me to get out of this. For those who
want to do the same thing here is the code i have made to get the type of the excel data field : Public Function GetDataFromXL() As DataTable Dim dt As New DataTable Dim dr As DataRow Dim plage As Excel.Range Dim col As Integer Dim row As Integer plage = XLApplication.Selection() col = plage.Columns.Count() row = plage.Rows.Count 'Dim ii As String = XLworksheet.Type.GetTypeCode.ToString For i As Integer = 0 To col - 1 dt.Columns.Add("Col" & i) Next For i As Integer = 0 To row - 1 dr = dt.NewRow For j As Integer = 0 To col - 1 dr(j) = plage.Value2(i + 1, j + 1) Debug.WriteLine(VarType(plage(i + 1, j + 1).Value())) Debug.WriteLine(plage.Value2(i + 1, j + 1)) Next dt.Rows.Add(dr) Next Return dt End Function Hope this will help someone else. Best Regards, |