In future posts, please enclose code in code tags as requested in forum rules.
Below is a 'cleaned up' version of your code that would request a file name and open the file:
Sub OpenStatementText()
Dim myfile As String
myfile = Application.GetOpenFilename("Text Files,*.txt")
If myfile <> "False" Then
Workbooks.OpenText Filename:=myfile, DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 3), Array(12, 3), Array(23, 1), Array(71, 1), Array(94, 1), Array(107, 1), _
Array(131, 1), Array(169, 1), Array(171, 1))
End If
End Sub
Press Alt-F11 from Excel to open the VBA window. From the View menu, select Project Explorer to open a tree view of your workbook. If you already have a code module, you'll see it there (probably Module1). If not, from the Insert menu, select Module to create one. That's where you'll normally enter or paste code, such as the above.
To proceed with cleanup of the pagination text, you would need to attach a sample text file. Please obscure any private data that it may contain, but be careful that doing so doesn't affect the layout of the data. For example, change My Name to xxxxxxx.
Bookmarks