ariel20029
Board Regular
- Joined
- Jun 20, 2013
- Messages
- 97
Hi all, I have a CSV file I need to open using notepad then import into exce when importing I need to convert Column X to text. The specific steps must be followed because if you do not open the CSV file with the notepad column X ends up with scientific notation due tot he long string of numbers. I found this macro to open the csv file with notepad but It says it can not locate the file. The text file is called b.csv and the folder is located on the C: drive in a folder called conversion. Also how do I tell it to take column X and make it TEXT and save to excel?
Thank you so much for all your help
Sharon
Sub importCSVFile()
Dim objWorkBook As Workbook
Dim myFile As String
srccsvfile = "C:\conversion\b.csv"
Workbooks.OpenText Filename:=myFile, Origin:=-535, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=False, Semicolon:=False, Comma:=False, Space:=False, _
Other:=True, OtherChar:=",", FieldInfo:=Array(Array(1, 1), Array(2, 2)), _
TrailingMinusNumbers:=True
Set objWorkBook = ActiveWorkbook
'do something with active WorkBook
End Sub
Thank you so much for all your help
Sharon
Sub importCSVFile()
Dim objWorkBook As Workbook
Dim myFile As String
srccsvfile = "C:\conversion\b.csv"
Workbooks.OpenText Filename:=myFile, Origin:=-535, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter _
:=False, Tab:=False, Semicolon:=False, Comma:=False, Space:=False, _
Other:=True, OtherChar:=",", FieldInfo:=Array(Array(1, 1), Array(2, 2)), _
TrailingMinusNumbers:=True
Set objWorkBook = ActiveWorkbook
'do something with active WorkBook
End Sub