LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
dan dan is offline
external usenet poster
 
Posts: 866
Default Opening a file

Is there a way to automatically run the File Wizard on the imported file with
the spacing I want. (The files that will be imported will always appear the
same).

Thanks

"Dave Peterson" wrote:

Dim myFileName as variant
dim FileNum as long

myfilename = application.getopenfilename("Text Files, *.txt")

if myfilename = false then
exit sub 'user hit cancel
end if

filenum = freefile()
open myfilename for input as #filenum





Dan wrote:

Trying to create a macro that prompts the user to open a txt file.

FileName = InputBox("Please enter the Text File's name, e.g. test.txt")
FileNum = FreeFile()
Open FileName For Input As #FileNum

But in place of having them enter the file name, I want to have them browse
for the file then select it. This would be identical to File - Open, and the
Open Browser window appears.

Thanks


--

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
Problem opening Excel file giantwolf Excel Discussion (Misc queries) 6 March 30th 06 08:58 AM
Excel crashes while opening excel file imbeddied with macros ct2147 Excel Discussion (Misc queries) 0 December 30th 05 09:05 PM
Formula related Crash on Opening File Nodak Excel Worksheet Functions 0 June 15th 05 01:41 PM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
Opening a file with a Macro Adam1 Chicago Excel Discussion (Misc queries) 2 February 28th 05 10:13 PM


All times are GMT +1. The time now is 02:11 PM.

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"