vba code to open workbooks

  • Thread starter Thread starter Rebecca1
  • Start date Start date
R

Rebecca1

Does anyone have a code that will open a workbook w/name Table.xls that is in
the same directory as the workbook w/name 248.xls that is open. I would
like for the Table workbook to open when a user opens 248 workbook.
 
hi
in the this workbook module of 248.xls, put this code. change the file path
to your file path.
Private Sub Workbook_Open()
Workbooks.Open Filename:= _
"C:\your\file\path\table.xls"
End Sub
to install..
open the vb editor.....Alt+F11
in the project window(far left), expand project 248.xls. click on this
workbook.
in the code window(far right), click on the left drop down and select
workbook.
Private Sub Workbook_Open() should default.
past the above code....
Workbooks.Open Filename:= _
"C:\your\file\path\table.xls"
close the vb editor and save the file.
each time 248.xls is opened, table.xls will open.

regards
FSt1
 
This works great! Just what I was looking for. After installing, I see
that I would like to take this a step further. Can you help me with a code
that will automatically minimize Table and also automatically close Table
when 248.xls is closed?
 
Back
Top