#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto-Open other file


Upon opening my main excel file, I would like another file in the same
folder to be opened. Is this possible?


--
aposatsk
------------------------------------------------------------------------
aposatsk's Profile: http://www.excelforum.com/member.php...o&userid=36709
View this thread: http://www.excelforum.com/showthread...hreadid=567601

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Auto-Open other file

One way is to use a macro:

Option Explicit
Sub auto_open()
Dim WkbkName As String
Dim TestStr As String

WkbkName = "book2.xls"

TestStr = ""
On Error Resume Next
TestStr = Dir(ThisWorkbook.Path & "\" & WkbkName)
On Error GoTo 0

If TestStr = "" Then
MsgBox "design error! " & WkbkName & " wasn't found."
Else
Workbooks.Open Filename:=ThisWorkbook.Path & "\" & WkbkName
End If

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

aposatsk wrote:

Upon opening my main excel file, I would like another file in the same
folder to be opened. Is this possible?

--
aposatsk
------------------------------------------------------------------------
aposatsk's Profile: http://www.excelforum.com/member.php...o&userid=36709
View this thread: http://www.excelforum.com/showthread...hreadid=567601


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Auto-Open other file

Another way is to save the files as a Workspace.

With both books open, FileSave Workspace.

A resume.xlw file will be created.

You can name it whatever you wish as long as you retain the XLW format.

Open that and both books will open.


Gord Dibben MS Excel MVP

On Wed, 2 Aug 2006 15:35:52 -0400, aposatsk
wrote:


Upon opening my main excel file, I would like another file in the same
folder to be opened. Is this possible?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Auto-Open other file


Gord Dibben Wrote:
Another way is to save the files as a Workspace.

With both books open, FileSave Workspace.

A resume.xlw file will be created.

You can name it whatever you wish as long as you retain the XLW
format.

Open that and both books will open.


Gord Dibben MS Excel MVP

On Wed, 2 Aug 2006 15:35:52 -0400, aposatsk
wrote:


Upon opening my main excel file, I would like another file in the

same
folder to be opened. Is this possible?


If i use this method, the files which open afterwards are the same
files, except all "Splits" and "Frozen Panes" are gone, and some of the
sheets are zoomed to different levels than in the original. Is there any
way to fix this and retain the same format?

Also, if i edit File 1 and File 2 and save each afterwards, will my
Workspace file take into account these changes? or do i have to re-save
the workspace?


--
aposatsk
------------------------------------------------------------------------
aposatsk's Profile: http://www.excelforum.com/member.php...o&userid=36709
View this thread: http://www.excelforum.com/showthread...hreadid=567601

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Auto-Open other file

First problem..................have not been able to find a way to retain the
Splits and Frozen Panes.

Second problem.............yes, the workbooks are saved with changes if saved
individually or saved as workspace.


Gord

On Thu, 3 Aug 2006 07:55:29 -0400, aposatsk
wrote:

If i use this method, the files which open afterwards are the same
files, except all "Splits" and "Frozen Panes" are gone, and some of the
sheets are zoomed to different levels than in the original. Is there any
way to fix this and retain the same format?

Also, if i edit File 1 and File 2 and save each afterwards, will my
Workspace file take into account these changes? or do i have to re-save
the workspace?




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Auto-Open other file

"aposatsk" wrote:

Upon opening my main excel file, I would like another file in the same
folder to be opened. Is this possible?


You can try this by saving the files in a workspace, but then your viewing
settings (show gridlines, row/col headers, etc.) are all replaced by defaults.

The way that worked best for me was to enter code similar to the following
in the "ThisWorkbook" module of my primary workbook in Visual Basic:

Private Sub Workbook_Open()

Dim MyPath As String
MyPath = ThisWorkbook.Path

Workbooks.Open (MyPath & "\workbook4.xls") 'Alternatively, you could
specify the full path
Workbooks.Open (MyPath & "\workbook3.xls")
Workbooks.Open (MyPath & "\workbook2.xls")

Workbooks(1).Activate 'Places
primary workbook on top

Application.ShowWindowsInTaskbar = False 'These two lines might not
be needed on
Application.ShowWindowsInTaskbar = True 'your system

End Sub

Now, whenever my primary workbook is opened, the other workbooks open
automatically, looking just as they were when I last saved them. This
example requires all the workbooks involved to be in the same directory as
the primary one, but you could always specify full paths.

On my system, something weird happens with the taskbar if I omit the last
two lines of the procedure; you may or may not need them on your system.

Good luck!
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
Code to Open Excel File Please Help Cole Excel Discussion (Misc queries) 2 July 10th 06 09:04 PM
Excel Outlook Attachments opening after several errors everytime cito_support Setting up and Configuration of Excel 2 March 13th 06 06:15 PM
Links picking up values from an older version of linked file Cate Links and Linking in Excel 4 October 20th 05 01:53 PM
Can Only open files using file ~ open tek4u Excel Discussion (Misc queries) 4 July 11th 05 05:31 PM
hidden rows & columns slow file open Simon Shaw Excel Discussion (Misc queries) 0 April 5th 05 12:21 AM


All times are GMT +1. The time now is 12:16 PM.

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

About Us

"It's about Microsoft Excel"