View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
BigBen BigBen is offline
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!