Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Opening files by VBA

Hello,

I want to open Excel-files (one by one) that are in a certain directory.
With the opened files I want to do some calculations by means of a VBA macro
which is stored in a already opened workbook. After the calculations the
files are closed again.

How do I manage to open the files one by one from the macro?

An answer to this would be very helpful...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Opening files by VBA

Dim sFile As String
sFile = Dir("C:\TestFolders\*.xls", vbNormal)
If sFile < "" Then
Do
'do your stuff
Debug.Print sFile
sFile = Dir
Loop Until sFile = ""
End If


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Dutch76" wrote in message
...
Hello,

I want to open Excel-files (one by one) that are in a certain directory.
With the opened files I want to do some calculations by means of a VBA
macro
which is stored in a already opened workbook. After the calculations the
files are closed again.

How do I manage to open the files one by one from the macro?

An answer to this would be very helpful...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Opening files by VBA

Thanx Bob, works perfect!

"Bob Phillips" wrote:

Dim sFile As String
sFile = Dir("C:\TestFolders\*.xls", vbNormal)
If sFile < "" Then
Do
'do your stuff
Debug.Print sFile
sFile = Dir
Loop Until sFile = ""
End If


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Dutch76" wrote in message
...
Hello,

I want to open Excel-files (one by one) that are in a certain directory.
With the opened files I want to do some calculations by means of a VBA
macro
which is stored in a already opened workbook. After the calculations the
files are closed again.

How do I manage to open the files one by one from the macro?

An answer to this would be very helpful...




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
show most recent files first when opening excel files Anne` Excel Discussion (Misc queries) 5 January 23rd 08 01:54 AM
Several files opening at once Buck[_2_] New Users to Excel 2 December 21st 07 01:04 AM
Opening Quattro Pro for Windows files (*.WB1 Files) using Excel 20 PoundMutt Excel Discussion (Misc queries) 1 June 20th 07 03:50 AM
opening files enyaw Excel Programming 1 August 17th 06 03:55 PM
How can I view files chronologically when opening multiple files Stevilsize Excel Discussion (Misc queries) 3 July 26th 05 12:49 AM


All times are GMT +1. The time now is 10:43 PM.

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"