Hello,
I recently found an example of a macro online to open a *.txt file. I was wondering if there is a workaround to open a *.csv file?
Thanks in advance.
Greg
Private Sub CommandButton4_Click()
' Ask the user for the file name to open.
myFile = Application.GetOpenFilename
ChDir "d:\test"
' Check for the Cancel button.
If myFile = False Then Exit Sub
' Open the Text file with the OpenText method.
Workbooks.OpenText Filename:=myFile, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, _
Tab:=False, Semicolon:=True, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(1, 1)
ActiveSheet.Name = "sheet1"
End Sub
I recently found an example of a macro online to open a *.txt file. I was wondering if there is a workaround to open a *.csv file?
Thanks in advance.
Greg
Private Sub CommandButton4_Click()
' Ask the user for the file name to open.
myFile = Application.GetOpenFilename
ChDir "d:\test"
' Check for the Cancel button.
If myFile = False Then Exit Sub
' Open the Text file with the OpenText method.
Workbooks.OpenText Filename:=myFile, Origin:=xlWindows, _
StartRow:=1, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, _
Tab:=False, Semicolon:=True, Comma:=False, Space:=False, _
Other:=False, FieldInfo:=Array(1, 1)
ActiveSheet.Name = "sheet1"
End Sub