#1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
external usenet poster
 
Posts: 42
Default Redirecting

Anyone know how to create a file which when opened by Excel 2003 causes it
to redirect itself and open a second (csv) file? I know how to get a web
browser to do this using http-equiv="REFRESH" but cannot do it within Excel.

Many thanks

T


  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
external usenet poster
 
Posts: 35,218
Default Redirecting

You can have a macro that in the first workbook that opens the .CSV file and
then closes itself:

Option Explicit
Sub auto_Open()
Workbooks.Open Filename:="C:\my documents\excel\book1.csv"
ThisWorkbook.Close savechanges:=False
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

tishoo wrote:

Anyone know how to create a file which when opened by Excel 2003 causes it
to redirect itself and open a second (csv) file? I know how to get a web
browser to do this using http-equiv="REFRESH" but cannot do it within Excel.

Many thanks

T


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
external usenet poster
 
Posts: 42
Default Redirecting


"Dave Peterson" wrote
You can have a macro that in the first workbook that opens the .CSV file
and
then closes itself:


Thanks for the response but what you suggest doesn't fit the bill.
I won't have access to the workbook once it's distributed and I want to keep
changing the destination file.


  #4   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
external usenet poster
 
Posts: 35,218
Default Redirecting

You could have the macro reads a text file to get the name and then open that
file.



tishoo wrote:

"Dave Peterson" wrote
You can have a macro that in the first workbook that opens the .CSV file
and
then closes itself:


Thanks for the response but what you suggest doesn't fit the bill.
I won't have access to the workbook once it's distributed and I want to keep
changing the destination file.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
external usenet poster
 
Posts: 42
Default Redirecting


"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?




  #6   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
external usenet poster
 
Posts: 35,218
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
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
Redirecting tishoo Excel Discussion (Misc queries) 12 December 27th 06 11:58 PM
redirecting personal.xls BorisS Excel Discussion (Misc queries) 5 December 5th 06 11:24 AM


All times are GMT +1. The time now is 06:39 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"