Yogi_Bear_79
09-17-2000, 09:32 PM
I want to import a text file into Excel. I have a macro in Excel that does it quite well, however I want to handle everyting from VB & not have to have an Excel macrobook with my program. THis is the code I have so far, however, I'm having a problem getting the field_info:= line correct.
Private Sub Command1_Click()
Dim objXLApp As Object
' Launch Microsoft Excel
Set objXLApp = CreateObject("Excel.Application")
objXLApp.Visible = True
With objXLApp
Workbooks.Open.Text("C:WINDOWSTEMPMP3_Export.txt", file_origin:=2, start_row:=1, _
file_type:=1, text_qualifier:=3, consecutive_delim:=False, tab:=True, _
semicolon:=False, comma:=False, Space:=False, Other:=True, other_char:="-", _
field_info:=Array(Array(1, 2), Array(2, 2)))
End With
End Sub
Private Sub Command1_Click()
Dim objXLApp As Object
' Launch Microsoft Excel
Set objXLApp = CreateObject("Excel.Application")
objXLApp.Visible = True
With objXLApp
Workbooks.Open.Text("C:WINDOWSTEMPMP3_Export.txt", file_origin:=2, start_row:=1, _
file_type:=1, text_qualifier:=3, consecutive_delim:=False, tab:=True, _
semicolon:=False, comma:=False, Space:=False, Other:=True, other_char:="-", _
field_info:=Array(Array(1, 2), Array(2, 2)))
End With
End Sub