ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA - Opening Files (https://www.excelbanter.com/excel-programming/290322-re-excel-vba-opening-files.html)

Tom Ogilvy

Excel VBA - Opening Files
 
fname = dir("C:\path1\*.xls")
do while fname < ""
set wkbk = workbooks.open("C:\path1\" & fname)
' process workbook
wkbk.close SaveChanges:=False ' or true
fname = dir()
Loop

--
Regards,
Tom Ogilvy


Brian wrote in message
...
How do I open up I folder and then open and close each file in that folder

consecutively? I am tring this:
Do Until FileName = today

Workbooks.Open FileName:= _
"Folder / FileName.xls"
Sheets("Sheet Name").Select
Range("N19").Select
Selection.Copy
ActiveWindow.Close
Windows("Window Name.xls").Activate
Range("B2").Select
ActiveSheet.Paste
Range("B3").Select

Loop






All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com