#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 186
Default Open files from List

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 56
Default Open files from List

This looks ok to me...what error are you getting? Do you have a
workbook with the right filename in the c:\documents directory?
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 186
Default Open files from List

yes - the file is there - the error message i get is file can't be found

"jasontferrell" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 56
Default Open files from List

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
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Open files from List

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????



Jack wrote:

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


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 186
Default Open files from List

Thanks

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

"jasontferrell" wrote:

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

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 186
Default Open files from List

Dave

thanks - i had the file as an excel 2007 once i changed it to 2003 this
worked.

"Dave Peterson" wrote:

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????



Jack wrote:

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


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 186
Default Open files from List

What code do i need to add so that i don;t show the files as they are opening?

"jasontferrell" wrote:

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

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 56
Default Open files from List

You can add:
Application.ScreenUpdating=False
at the beginning and then set it to true at the end.
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 186
Default Open files from List

Thanks for all your help

"jasontferrell" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 List of Open Files? Bob Newman Excel Discussion (Misc queries) 1 November 23rd 08 09:50 PM
How to change default Open/Files of Type to "Microsoft Excel Files Tammy Excel Discussion (Misc queries) 2 January 14th 08 11:06 PM
How to open a list of excel files and get update, then close it? Eric Excel Discussion (Misc queries) 4 June 10th 07 08:58 AM
Cannot open files in Most Recently Used List Suzan Excel Discussion (Misc queries) 3 July 29th 06 11:32 PM
create a list of worksheet names (from a single folder, or open files) Drew Excel Discussion (Misc queries) 2 April 15th 05 04:58 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"