MARK858
MrExcel MVP
- Joined
- Nov 12, 2010
- Messages
- 16,816
- Office Version
- 365
- Platform
- Windows
- Mobile
I have the following code that allows the user to select a .txt file from his chosen location but I am stuck as how to get the click on the open button to do the final open on the file.
Any advice would be welcomed.
The end objective, in case it makes a difference is to open the .txt file, have excel put in the delimiter based on spaces then import/paste the file into sheet 2 of the active sheet. But 1 stage at a time, so all I am looking for at present is how to get the click on the open button working
Any advice would be welcomed.
Code:
Public DI As String
Public DIName As String
Public DIPath As String
Sub RunText_Click()
Dim wsName As String
Call GetImportFilename
End Sub
Sub GetImportFilename(Optional strTitle As String)
Dim i As Integer
If Len(strTitle) = 0 Then strTitle = "..."
DI = Application.GetOpenFilename("Text Files (*.txt), *.txt,All Files (*.*),*.*", , strTitle, , False)
End Sub
The end objective, in case it makes a difference is to open the .txt file, have excel put in the delimiter based on spaces then import/paste the file into sheet 2 of the active sheet. But 1 stage at a time, so all I am looking for at present is how to get the click on the open button working