Recognize pipes "|" in when opening a delimited file in Excel

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

Guest

Automatically open delimited files without having the 3-step input box and
include pipes "|" in the delimiting characters.
 
I recorded a macro, tweaked the code a little, and used
the workbook_open event:

Sub Workbook_Open()
Dim sPath As String
Dim sFile As String
sPath = "C:\Documents and Settings\jmorin\Desktop\"
sFile = "test.txt"
Workbooks.OpenText Filename:= _
sPath & sFile, _
Origin:=437, _
StartRow:=1, _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=False, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=True, _
OtherChar:="|"
End Sub

---
Change sPath and sFile to your actual path and file. To
use this macro, save it in ThisWorkbook module (Press
ALT+F11). Save the file and close. Re-open.

HTH
Jason
Atlanta, Ga
 
Back
Top