A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Setting up and Configuration
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Redirecting



 
 
Thread Tools Display Modes
  #1  
Old December 27th, 2006, 01:35 AM posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
tishoo
external usenet poster
 
Posts: 28
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  
Old December 27th, 2006, 01:50 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

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  
Old December 27th, 2006, 02:13 AM posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
tishoo
external usenet poster
 
Posts: 28
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  
Old December 27th, 2006, 02:25 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

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  
Old December 27th, 2006, 03:08 AM posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
tishoo
external usenet poster
 
Posts: 28
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  
Old December 27th, 2006, 04: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
  #7  
Old December 27th, 2006, 11:51 AM posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
tishoo
external usenet poster
 
Posts: 28
Default Redirecting


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


Thanks - works great if c:\myfile.txt is a local file. Doesn't work if it is
a network file - like http://www.mywebspace.com/myfile.txt

Unfortunately needs to be network for users to access it.


  #8  
Old December 27th, 2006, 01:34 PM 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

Maybe you can put it on a common network share. I don't speak the http stuff.

tishoo wrote:

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


Thanks - works great if c:\myfile.txt is a local file. Doesn't work if it is
a network file - like http://www.mywebspace.com/myfile.txt

Unfortunately needs to be network for users to access it.


--

Dave Peterson
  #9  
Old December 27th, 2006, 01:38 PM 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

Ps. You may want to give all the requirements in your original posts. Then
someone who actually knows how to help may jump in.

Dave Peterson wrote:

Maybe you can put it on a common network share. I don't speak the http stuff.

tishoo wrote:

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


Thanks - works great if c:\myfile.txt is a local file. Doesn't work if it is
a network file - like http://www.mywebspace.com/myfile.txt

Unfortunately needs to be network for users to access it.


--

Dave Peterson


--

Dave Peterson
  #10  
Old December 28th, 2006, 12:07 AM posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.setup
tishoo
external usenet poster
 
Posts: 28
Default Redirecting


"Dave Peterson" wrote

Ps. You may want to give all the requirements in your original posts.
Then
someone who actually knows how to help may jump in.


Apologies. I took it for granted that it would have to be a network file.
You're right though - I should have been more detailed.

I think the only way to do this would be a minor variant on your first
ingenious suggestion. If I program the distributed sheet1.xls to open a
second on the network (www.myswebspace.com/sheet2.xls) which I can alter at
will. Sheet2.xls can, as you suggested, be programmed to open
www.mywebspace.com/data.csv file and then close itself.

My only problem then is how to auto-switch back to sheet1.xls once that
procedure is complete. Users don't want to see the csv file - it just needs
to be open.

Any ideas gratefully received.

T


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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