LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default opening text file in excel through inputbox

Option Explicit
Sub Testme01()

Dim myFileName As Variant
Dim TextWks as worksheet

myFileName = Application.GetOpenFilename(filefilter:="Text Files, *.Txt", _
Title:="Pick a File")

If myFileName = False Then
MsgBox "Ok, try later" 'user hit cancel
Exit Sub
End If

Workbooks.OpenText Filename:=myFileName '....rest of recorded code here!

set TextWks = activesheet

End Sub

"Adi H." wrote:

Hello,
I want to open a text file in excel, then user some delimiters. How can
I combine this with the fact that one will enter the filename in a
dialog box (input box) ?
Also, I don't want to see all the screens with what kind of delimiters
to use.

Like:
Workbooks.OpenText Filename:=num_fis_ancin & ".txt"
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlNone, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=True,
Comma:= _
True, Space:=True, Other:=True, OtherChar:="=",
FieldInfo:=Array(Array( _
1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1),
Array(6, 1), Array(7, 1)), _
TrailingMinusNumbers:=True
But as I said, I would like that the name of the file to be input
through a inputbox or using something like
Application.GetOpenFilename(FileFilter:="Text Files (*.txt), *.txt"...


--

Dave Peterson
 
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
Opening a text file in excel Opyuse Excel Discussion (Misc queries) 4 June 13th 05 09:23 PM
Opening text file in Excel Eric[_6_] Excel Programming 1 December 10th 03 05:18 PM
Opening text file in Excel through macro Tom Ogilvy Excel Programming 0 October 7th 03 03:53 PM
Opening text file in Excel through macro shockley Excel Programming 0 October 7th 03 03:49 PM
Adding text to a text file using an inputbox Proedrsmith Excel Programming 3 September 12th 03 01:16 PM


All times are GMT +1. The time now is 07:09 AM.

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

About Us

"It's about Microsoft Excel"