ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   vba code to open workbooks (https://www.excelbanter.com/excel-worksheet-functions/178625-vba-code-open-workbooks.html)

Rebecca1

vba code to open workbooks
 
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.

FSt1

vba code to open workbooks
 
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
"Rebecca1" wrote:

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.


Gary''s Student

vba code to open workbooks
 
This macro determines the path and then open Table.xls
--
Gary''s Student - gsnu200771


"Rebecca1" wrote:

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.


Rebecca1

vba code to open workbooks
 
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?

"FSt1" wrote:

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
"Rebecca1" wrote:

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.



All times are GMT +1. The time now is 03:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com