how do i open a second workbook automatically

S

swain.s

i have tried all of the following

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

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

i have several answers but none work
 
T

Tom Hutchins

What do you mean when you say it doesn't work? Do you get an error message or
does nothing seem to happen at all? If you get an error message that the file
cannot be found, the path and/or filename in the macro are not correct. If
nothing seems to happen, you probably have macros disabled or the code is not
in the ThisWorkbook module (when you are in the ThisWorkbook module, the
title at the top of the screen should say [ThisWorkbook (Code)].) There is
nothing wrong with the code itself.

Hope this helps,

Hutch
 
S

swain.s

run time error'1004'
Tom Hutchins said:
What do you mean when you say it doesn't work? Do you get an error message or
does nothing seem to happen at all? If you get an error message that the file
cannot be found, the path and/or filename in the macro are not correct. If
nothing seems to happen, you probably have macros disabled or the code is not
in the ThisWorkbook module (when you are in the ThisWorkbook module, the
title at the top of the screen should say [ThisWorkbook (Code)].) There is
nothing wrong with the code itself.

Hope this helps,

Hutch

i have tried all of the following

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

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


i have several answers but none work
 
G

Gord Dibben

1004 generally means there is no such path or filename.


Gord Dibben MS Excel MVP

run time error'1004'
Tom Hutchins said:
What do you mean when you say it doesn't work? Do you get an error message or
does nothing seem to happen at all? If you get an error message that the file
cannot be found, the path and/or filename in the macro are not correct. If
nothing seems to happen, you probably have macros disabled or the code is not
in the ThisWorkbook module (when you are in the ThisWorkbook module, the
title at the top of the screen should say [ThisWorkbook (Code)].) There is
nothing wrong with the code itself.

Hope this helps,

Hutch

i have tried all of the following

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

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

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

i have several answers but none work
 
S

swain.s

i had to change the flie extension from .xls to .xlsx to work with office 2007

Gord Dibben said:
1004 generally means there is no such path or filename.


Gord Dibben MS Excel MVP

run time error'1004'
Tom Hutchins said:
What do you mean when you say it doesn't work? Do you get an error message or
does nothing seem to happen at all? If you get an error message that the file
cannot be found, the path and/or filename in the macro are not correct. If
nothing seems to happen, you probably have macros disabled or the code is not
in the ThisWorkbook module (when you are in the ThisWorkbook module, the
title at the top of the screen should say [ThisWorkbook (Code)].) There is
nothing wrong with the code itself.

Hope this helps,

Hutch

:

i have tried all of the following

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

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

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

i have several answers but none work

.
 
G

Gord Dibben

You should be able to open *.xls files in 2007 version.


Gord

i had to change the flie extension from .xls to .xlsx to work with office 2007

Gord Dibben said:
1004 generally means there is no such path or filename.


Gord Dibben MS Excel MVP

run time error'1004'
:

What do you mean when you say it doesn't work? Do you get an error message or
does nothing seem to happen at all? If you get an error message that the file
cannot be found, the path and/or filename in the macro are not correct. If
nothing seems to happen, you probably have macros disabled or the code is not
in the ThisWorkbook module (when you are in the ThisWorkbook module, the
title at the top of the screen should say [ThisWorkbook (Code)].) There is
nothing wrong with the code itself.

Hope this helps,

Hutch

:

i have tried all of the following

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

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

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

i have several answers but none work

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top