Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 47
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 47
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink not working in 2003 for JPG & PNG files Andy Sarno[_2_] Excel Discussion (Misc queries) 0 June 7th 07 02:41 PM
Cell References Between sheets or Files Not Working MM Phil Excel Discussion (Misc queries) 3 February 1st 07 10:01 PM
less noise when working with CSV files Rick Lowe Excel Discussion (Misc queries) 0 June 5th 06 06:33 PM
working excel files keeping on desktop Eddy Stan Excel Worksheet Functions 1 February 17th 06 12:42 PM
Installed Analyst Toolpak but not working for files used at work? SJB567 Excel Worksheet Functions 2 May 14th 05 06:50 PM


All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"