Open files from List

J

Jack

I'm trying to open a group of files from a list starting at D5 on the Menu
worksheet.
Following is the code i have tried.

sub open_files()
dim fname
With ActiveWorkbook
fname = "c:\documents\" & .worksheets("Menu").range("D5").value & ".xls"
Workbooks.Open Filename:= fname
End With
End Sub

the macro stops at the workbooks.open step - help would be appreciated
 
J

jasontferrell

This looks ok to me...what error are you getting? Do you have a
workbook with the right filename in the c:\documents directory?
 
J

jasontferrell

Change you code to add a msgbox that will display while running. Then
check the filename. You could've duplicated the "xls".

sub open_files()
dim fname
With ActiveWorkbook
fname = "c:\documents\" & .worksheets("Menu").range("D5").value &
".xls"
msgbox fname
Workbooks.Open Filename:= fname
End With
End Sub
 
D

Dave Peterson

If the workbook is opening, then the macro stops, change the shortcut key that
you use to run the macro. Do not include the shift key.

If the code stops before the workbook is opened, then what's the error? Maybe
you don't have a workbook with that name????
 
J

Jack

Thanks

the file was a 2007 file - when i save it as a 2003 the macro worked.
thanks for your help
 
J

jasontferrell

You can add:
Application.ScreenUpdating=False
at the beginning and then set it to true at the end.
 

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