PDA

View Full Version : Error Problem



Mooseman60
11-19-2010, 06:21 PM
http://www.mrexcel.com/forum/images/smilies/confused.gifI have a workbook that opens with a userform Menu. I have another workbook called Defined Name Lists.xls which stores Employee, Suppliers details etc.
My problem is that when I click on any of the menu buttons that need to lookup data from the Defined Name Lists.xls workbook I get the following message
Run-time error '1004' Defined Name Lists.xls cannot be found. Check spelling of the file name and verify that the file location is correct.

I have spent hours checking the spelling and file path trying to work out what the problem is without success.

I am using Microsoft 2003 on Windows 7 Ultimate

Also when I open my workbook with the userform Menu Do I need the Defined Name Lists.xls to open at the same time and if so how do I do this

Any help would be greatly appreciated

I have attached my workbook

shrivallabha
11-20-2010, 02:54 AM
In the ThisWorkbook's Worksheet_Open event, add following code
Workbooks.Open ("FilePath\Defined Name Lists.xls")
Where, FilePath is the location path where you've stored the file.
This will open the Workbook in the first place.

Mooseman60
11-20-2010, 05:58 AM
In the ThisWorkbook's Worksheet_Open event, add following code
Workbooks.Open ("FilePath\Defined Name Lists.xls") Where, FilePath is the location path where you've stored the file.
This will open the Workbook in the first place.
This is the code i placed in the workbook



Private Sub Workbook_Open()
Workbooks.Open ("Users\users\Documents\Defined
Name Lists.xls")
End Sub

It comes up with a Run-time error 1004

Bob Phillips
11-20-2010, 06:30 AM
The code, not the Sub and End Sub, should all be on one line.

shrivallabha
11-21-2010, 12:28 AM
In case, you do not want on a single line to make it readable then use
_ (space and underscore) at the end of first line!