i want to open a second workbook automatically when i open the fir

S

swain.s

both work books are in C:\
the master workbook name is test
the slave workbook name is data
 
J

Jacob Skaria

--You can open multiple workbooks and save as workspace .xlw. Opening this
workspace would open all linked workbooks.

--VBA method...Set the security level to low/medium in
(Tools|Macro|Security). Open master workbook. Press Alt+F11 to launch VBE
(Visual Basic Editor). From the left treeview search for the workbook name
and click on + to expand it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.
Private Sub Workbook_Open()
Workbooks.Open Me.Path & "\data.xls"
End Sub

Save>Close and re-open master file..which should open the data.xls from the
same folder

If this post helps click Yes
 
G

Gary''s Student

Include the following event macro in the workbook code area of the test
workbook:

Private Sub Workbook_Open()
Workbooks.Open ("C:\data.xls")
End Sub

Because it is workbook code, it is very easy to install and use:

1. right-click the tiny Excel icon just to the left of File on the Menu Bar
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (workbook code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
S

swain.s

'run-time error 1004' comes up

Gary''s Student said:
Include the following event macro in the workbook code area of the test
workbook:

Private Sub Workbook_Open()
Workbooks.Open ("C:\data.xls")
End Sub

Because it is workbook code, it is very easy to install and use:

1. right-click the tiny Excel icon just to the left of File on the Menu Bar
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (workbook code), see:

http://www.mvps.org/dmcritchie/excel/event.htm
 
S

swain.s

'run-time error 1004' comes up

Jacob Skaria said:
--You can open multiple workbooks and save as workspace .xlw. Opening this
workspace would open all linked workbooks.

--VBA method...Set the security level to low/medium in
(Tools|Macro|Security). Open master workbook. Press Alt+F11 to launch VBE
(Visual Basic Editor). From the left treeview search for the workbook name
and click on + to expand it. Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.
Private Sub Workbook_Open()
Workbooks.Open Me.Path & "\data.xls"
End Sub

Save>Close and re-open master file..which should open the data.xls from the
same folder

If this post helps click Yes
 
S

swain.s

this code worked before but now it dosn't i found it in a previous timesheet
vba

Private Sub Workbook_Open()
Workbooks.Open Filename:="D:\lorne stewart\timesheet\2008\data.xls"
End Sub
 
G

Gord Dibben

Help...........record a macro

Note the part about adding the Developer Tab to the Ribbon.


Gord Dibben MS Excel MVP
 
S

swain.s

i am giving up on this project as i can't seem to get the answer that i need
to get it to work
 
Top