Thread: Redirecting
View Single Post
  #6  
Old December 27th, 2006, 03:36 AM posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Redirecting

Option Explicit
Sub Auto_Open()

Dim TextLine As String
Open "C:\myfile.txt" For Input As #1
Line Input #1, TextLine
Close #1

Workbooks.Open Filename:=TextLine
ThisWorkbook.Close savechanges:=False

End Sub

You should add some validity checks to it.

C:\myfile.txt
is a plain old text file that contains one line of data--the full name of the
..csv file.



tishoo wrote:

"Dave Peterson" wrote in message
...
You could have the macro reads a text file to get the name and then open
that
file.


that could work. Any idea how I might do that?


--

Dave Peterson