Hi,
Could anybody help me with this parameter FieldInfo???
When I don't use this parameter I can import my text-file to Excel, but I want to assign my Columns to a Datatype.
Here's my code (Visual Basic 6):
Dim intCol(250), intDataType(250) As Integer
Dim intArray(250, 250) As Integer
Dim intTel As Integer
For intTel = 0 To UBound(intCol)
intCol(intTel) = intTel + 1
Next intTel
For intTel = 0 To UBound(intDataType)
intDataType(intTel) = xlGeneralFormat
Next intTel
' populate the array for fieldinfo
For intTel = LBound(intArray) To UBound(intArray)
intArray(intTel, 1) = intCol(intTel)
intArray(intTel, 2) = intDataType(intTel)
Next intTel
If strSep = "" Then
strSep = vbTab
End If
Dim objEXL As New Excel.Application
If objEXL Is Nothing Then
MsgBox ("Couldn't start Excel")
Exit Function
Else
On Error GoTo EndMacro:
objEXL.Application.ScreenUpdating = False
'Creating Workbook
Dim objWBook As Workbook
'Create a new spreadsheet
Set objWBook = objEXL.Workbooks.Add
'Creating worksheet
Dim objWSheet As New Excel.Worksheet
'Adding new worksheet to excel workbooks
Set objWSheet = objEXL.ActiveSheet
objEXL.Workbooks.OpenText FileName:=strImportFilePath, Origin:=xlMSDOS, StartRow:=2, _
Local:=True, DecimalSeparator:=",", ThousandsSeparator:=".", FieldInfo:=intArray
Set objWBook = ActiveWorkbook
End If
Bookmarks