LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Excel macro to open files within a folder

Graig;
I was given this program open an excel file (see below). The only thing you
have to do is put everything under one directory.

Maperalia

'*********Start Program Open Excel File****************
Sub OpenExcelFile()

directory = ThisWorkbook.path & "\"
filetext = Selection.Value & ".xls"
If filetext = ".xls" Then
MsgBox "Please select a File"
Exit Sub
End If
Workbooks.Open directory & filetext
End Sub
'*********End of Program Open Excel File****************




"Ron de Bruin" wrote:

Hi Graig

See this example
http://www.rondebruin.nl/copy3.htm#range2


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Craig" wrote in message ups.com...
I'm trying to create a macro to open all of the files within a certain
folder. For example, it would open all of the .xls files in
C:\Timesheets. I'm lost on how to do this. I'm able to get a single
file open if I have the file name, but the file names are going to
vary. Also is it possible to only open certain files within a specific
folder based on parameters of the filename (like all files starting
with 07*****.xls)?




 
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
How do you set Excel 2007 to open files in a specific folder? Opening to a specific folder Excel Discussion (Misc queries) 2 August 12th 07 02:58 AM
can't open excel files from common folder dsdproduction Excel Discussion (Misc queries) 4 July 5th 07 08:34 PM
Can't Open Certain Excel Files in Folder Charles A C Excel Discussion (Misc queries) 2 March 23rd 07 12:02 AM
Open Excel files in a folder Tom Ogilvy Excel Programming 0 August 20th 03 04:59 PM
Open Excel files in a folder Bob Phillips[_5_] Excel Programming 0 August 20th 03 04:47 PM


All times are GMT +1. The time now is 08:40 AM.

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

About Us

"It's about Microsoft Excel"