![]() |
working with .txt files in a macro
I'm trying to open a file folder so I can then open a .txt file. The .txt
files will all have unique numbers against them and I cannot figure out how to tell my macro to open the folder but let me choose the .txt file I need to open. |
working with .txt files in a macro
Maybe this willh help............
Sub Getfile() '=========================================== 'Offers pop-up to allow user to select file to be opened, then opens it '=========================================== Dim FileToCheck FileToCheck = Application.GetOpenFilename("Excel file to test (*.xls),*.xls") If FileToCheck < False Then On Error Resume Next Workbooks.Open FileName:=FileToCheck End If End Sub "Peggy" wrote: I'm trying to open a file folder so I can then open a .txt file. The .txt files will all have unique numbers against them and I cannot figure out how to tell my macro to open the folder but let me choose the .txt file I need to open. |
working with .txt files in a macro
Thank you for this code. It works really well, and I've tweaked it to open
..txt files. How do I format the spreadsheet as it is reading everything in one cell. meaning I have a complete sentence in one cell, whereas I need the information all in separate cells. Any easy tips, rather than writing lengthy 'if' formulas?!! Thanks for your help. Kind regards, Peggy "CLR" wrote: Maybe this willh help............ Sub Getfile() '=========================================== 'Offers pop-up to allow user to select file to be opened, then opens it '=========================================== Dim FileToCheck FileToCheck = Application.GetOpenFilename("Excel file to test (*.xls),*.xls") If FileToCheck < False Then On Error Resume Next Workbooks.Open FileName:=FileToCheck End If End Sub "Peggy" wrote: I'm trying to open a file folder so I can then open a .txt file. The .txt files will all have unique numbers against them and I cannot figure out how to tell my macro to open the folder but let me choose the .txt file I need to open. |
working with .txt files in a macro
Try this.......
Data TextToColumns Delimited select "space" for the delimiter....... Vaya con Dios, Chuck, CABGx3 "Peggy" wrote: Thank you for this code. It works really well, and I've tweaked it to open .txt files. How do I format the spreadsheet as it is reading everything in one cell. meaning I have a complete sentence in one cell, whereas I need the information all in separate cells. Any easy tips, rather than writing lengthy 'if' formulas?!! Thanks for your help. Kind regards, Peggy "CLR" wrote: Maybe this willh help............ Sub Getfile() '=========================================== 'Offers pop-up to allow user to select file to be opened, then opens it '=========================================== Dim FileToCheck FileToCheck = Application.GetOpenFilename("Excel file to test (*.xls),*.xls") If FileToCheck < False Then On Error Resume Next Workbooks.Open FileName:=FileToCheck End If End Sub "Peggy" wrote: I'm trying to open a file folder so I can then open a .txt file. The .txt files will all have unique numbers against them and I cannot figure out how to tell my macro to open the folder but let me choose the .txt file I need to open. |
All times are GMT +1. The time now is 10:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com