I'm trying to execute a Texttocolumns command from a vb module in Access against an Excel spreadsheet.
Here's my code:
Sub parsetext()
'
' parsetext Macro
'
Dim strexceltab As String
strexceltab = "excel"
objXLApp.Worksheets(strexceltab).Range("b1").Select
objXLApp.Worksheets(strexceltab).Range("b1").Activate
objXLApp.Selection.EntireColumn.Insert
objXLApp.Selection.EntireColumn.Insert
objXLApp.Selection.EntireColumn.Insert
objXLApp.Selection.EntireColumn.Insert
' Application.CutCopyMode = False
objXLApp.Worksheets(strexceltab).Range("a2:a380").Select
objXLApp.Worksheets(strexceltab).Range("a2:a380").Activate
objXLApp.Selection.TextToColumns.Destination(Range("b1")) _
.DataType(xlDelimited) _
.TextQualifier(xlNone) _
.ConsecutiveDelimiter(False) _
.Tab(False) _
.Semicolon(False) _
.Comma(False) _
.Space(False) _
.Other(True) _
.OtherChar(".") _
.FieldInfo (Array(Array(1, 1), Array(2, 1), Array(3, 1)))
End Sub
The insert of the three columns works fine and the selection of the area prior to the texttocolumns command works fine as well.
The data in the first column contains data such as:
Atlanta.Anderson, Mark - 5501.C8000 INSTRUMENT
Atlanta.Anderson, Mark - 5501.All Instruments
Atlanta.Atlanta.C8000 INSTRUMENT
It is delimited by a period.
I am getting this error:
Error #1004:Application-defined or object_defined error
Here's my code:
Sub parsetext()
'
' parsetext Macro
'
Dim strexceltab As String
strexceltab = "excel"
objXLApp.Worksheets(strexceltab).Range("b1").Select
objXLApp.Worksheets(strexceltab).Range("b1").Activate
objXLApp.Selection.EntireColumn.Insert
objXLApp.Selection.EntireColumn.Insert
objXLApp.Selection.EntireColumn.Insert
objXLApp.Selection.EntireColumn.Insert
' Application.CutCopyMode = False
objXLApp.Worksheets(strexceltab).Range("a2:a380").Select
objXLApp.Worksheets(strexceltab).Range("a2:a380").Activate
objXLApp.Selection.TextToColumns.Destination(Range("b1")) _
.DataType(xlDelimited) _
.TextQualifier(xlNone) _
.ConsecutiveDelimiter(False) _
.Tab(False) _
.Semicolon(False) _
.Comma(False) _
.Space(False) _
.Other(True) _
.OtherChar(".") _
.FieldInfo (Array(Array(1, 1), Array(2, 1), Array(3, 1)))
End Sub
The insert of the three columns works fine and the selection of the area prior to the texttocolumns command works fine as well.
The data in the first column contains data such as:
Atlanta.Anderson, Mark - 5501.C8000 INSTRUMENT
Atlanta.Anderson, Mark - 5501.All Instruments
Atlanta.Atlanta.C8000 INSTRUMENT
It is delimited by a period.
I am getting this error:
Error #1004:Application-defined or object_defined error