15-03-18 10:06 PM
Answered! Go to Answer.
23-03-18 10:58 AM
23-03-18 10:58 AM
11-01-20 07:48 AM
02-09-20 11:56 PM
Dim matrix = New Integer(6, 1) {{1, 1}, {2, 1}, {3, 9}, {4, 1}, {5, 1}, {6, 1}, {7, 1}}
FieldInfo:=matrix
Dim wb, ws As Object
Dim excel, sheet, range As Object
Dim matrix = New Integer(6, 1) {{1, 1}, {2, 1}, {3, 9}, {4, 1}, {5, 1}, {6, 1}, {7, 1}}
Try
wb = GetWorkbook(Handle, Workbook)
ws = GetWorksheet(Handle, Workbook, Worksheet)
wb.Activate()
ws.Activate()
excel = ws.Application
excel.Selection.TextToColumns (Destination:=excel.Range(Cell_Reference), DataType:=1, _
TextQualifier:=-4142, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:=Delimiter, FieldInfo:=matrix, TrailingMinusNumbers:=True)
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
ws = Nothing
excel = Nothing
sheet = Nothing
range = Nothing
End Try
02-03-22 01:57 PM
02-03-22 03:07 PM
04-03-22 03:30 PM
Hi the following code should work:
In this link you will find the integer for the type of format you need it. https://docs.microsoft.com/en-us/office/vba/api/excel.xlcolumndatatype
Remember that the The first element is the column number (1-based), and the second element is one of the XlColumnDataType constants specifying how the column is parsed.
Dim wb, ws As Object
Dim excel, sheet, range As Object
Dim matrix = New Integer(2, 1) {{1, 4}, {2, 4}}
Try
wb = GetWorkbook(Handle, Workbook)
ws = GetWorksheet(Handle, Workbook, Worksheet)
wb.Activate()
ws.Activate()
excel = ws.Application
excel.Selection.TextToColumns (Destination:=excel.Range(Cell_Reference), DataType:=1, _
TextQualifier:=-4142, ConsecutiveDelimiter:=False, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:=Delimiter, FieldInfo:=matrix, TrailingMinusNumbers:=True)
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
ws = Nothing
excel = Nothing
sheet = Nothing
range = Nothing
End Try
Let me know if you have any questions. And I could try to explain it to you in a deeper way.
Have a nice day.
23-09-22 06:42 PM
25-09-22 11:01 PM
26-09-22 01:00 PM
Dim wb, ws As Object
Dim excel, sheet, range As Object
Dim matrix = New Integer(6, 1) {{1, 1}, {2, 1},{3, 9},{4, 1},{5, 1},{6, 1},{7,1}}
Try
wb = GetWorkbook(Handle, Workbook)
ws = GetWorksheet(Handle, Workbook, Worksheet)
wb.Activate()
ws.Activate()
excel = ws.Application
excel.Columns("AG:AG").Select
excel.Selection.TextToColumns (Destination:=excel.Range("AG1"), DataType:=1, _
TextQualifier:=-4142, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo:=matrix, TrailingMinusNumbers:=True)
Success = True
Catch e As Exception
Success = False
Message = e.Message
Finally
wb = Nothing
ws = Nothing
excel = Nothing
sheet = Nothing
range = Nothing
End Try