Importing from CSV file with the BASIC procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Can someone help me? I need to write THE BASIC vba procedure to extract a
..csv (first name , last name) that will be sent to colums (A10:A20) and
(B10:B20).

Thanks.
Joe
 
I used a learn macro and got the following code. You can eliminate a number
of the parameters. they aren't really needed. I added a comment to these
unecessary lines

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 6/13/2007 by Joel
'

'
With ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\TEMP\f_l.csv", _
Destination:=Range("A10"))
.Name = "f_l"
.FieldNames = True
' .RowNumbers = False
' .FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
' .RefreshStyle = xlInsertDeleteCells
' .SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
' .RefreshPeriod = 0
' .TextFilePromptOnRefresh = False
' .TextFilePlatform = 437
' .TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
' .TextFileTabDelimiter = False
' .TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
' .TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1)
' .TextFileTrailingMinusNumbers = True
' .Refresh BackgroundQuery:=False
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top