Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Open a file do a macro ( made) and open next succesive file

Open a file do a macro ( made) and open next succesive file

File name yyyy-mm-ddxxxx.csv <--- the date is the creation date.
can I have excel run the macro to auto matically open first file in dir run
its parse and save ( this is done) THEN open the next file and continue?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Open a file do a macro ( made) and open next succesive file

Here's the general idea:

Sub OpenUserSelectedFiles()
Dim i As Integer
Dim filearray As Variant

filearray = Application.GetOpenFilename( _
Title:="Select the files to process", MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
'Call your macro here
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub

HTH,
Bernie
MS Excel MVP


"SVTman74" wrote in message
...
Open a file do a macro ( made) and open next succesive file

File name yyyy-mm-ddxxxx.csv <--- the date is the creation date.
can I have excel run the macro to auto matically open first file in dir run
its parse and save ( this is done) THEN open the next file and continue?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Open a file do a macro ( made) and open next succesive file

Do you know anyway when using the Application.GetOpenFilename function to use
a specific filename that is a defined string?
Example: SName is BP-Sarasota.xls
Tried fname=Application.GetOpenFilename(SName) but no joy.
Any ideas?

David

"Bernie Deitrick" wrote:

Here's the general idea:

Sub OpenUserSelectedFiles()
Dim i As Integer
Dim filearray As Variant

filearray = Application.GetOpenFilename( _
Title:="Select the files to process", MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
'Call your macro here
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub

HTH,
Bernie
MS Excel MVP


"SVTman74" wrote in message
...
Open a file do a macro ( made) and open next succesive file

File name yyyy-mm-ddxxxx.csv <--- the date is the creation date.
can I have excel run the macro to auto matically open first file in dir run
its parse and save ( this is done) THEN open the next file and continue?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Open a file do a macro ( made) and open next succesive file

That is not the way GetOpenFilename works. GetOpenFilename launches a dialog
box asking the user to select which files should be opened.

"David" wrote:

Do you know anyway when using the Application.GetOpenFilename function to use
a specific filename that is a defined string?
Example: SName is BP-Sarasota.xls
Tried fname=Application.GetOpenFilename(SName) but no joy.
Any ideas?

David

"Bernie Deitrick" wrote:

Here's the general idea:

Sub OpenUserSelectedFiles()
Dim i As Integer
Dim filearray As Variant

filearray = Application.GetOpenFilename( _
Title:="Select the files to process", MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
'Call your macro here
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub

HTH,
Bernie
MS Excel MVP


"SVTman74" wrote in message
...
Open a file do a macro ( made) and open next succesive file

File name yyyy-mm-ddxxxx.csv <--- the date is the creation date.
can I have excel run the macro to auto matically open first file in dir run
its parse and save ( this is done) THEN open the next file and continue?





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Open a file do a macro ( made) and open next succesive file

No kiddin Sherlock!
You must be a democrat...pointing out the negative with no solution.

"Lucas Swanson" wrote:

That is not the way GetOpenFilename works. GetOpenFilename launches a dialog
box asking the user to select which files should be opened.

"David" wrote:

Do you know anyway when using the Application.GetOpenFilename function to use
a specific filename that is a defined string?
Example: SName is BP-Sarasota.xls
Tried fname=Application.GetOpenFilename(SName) but no joy.
Any ideas?

David

"Bernie Deitrick" wrote:

Here's the general idea:

Sub OpenUserSelectedFiles()
Dim i As Integer
Dim filearray As Variant

filearray = Application.GetOpenFilename( _
Title:="Select the files to process", MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
'Call your macro here
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub

HTH,
Bernie
MS Excel MVP


"SVTman74" wrote in message
...
Open a file do a macro ( made) and open next succesive file

File name yyyy-mm-ddxxxx.csv <--- the date is the creation date.
can I have excel run the macro to auto matically open first file in dir run
its parse and save ( this is done) THEN open the next file and continue?







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Open a file do a macro ( made) and open next succesive file

Sorry, I did not have time to post a full reply.

If you want to open a file with a given filename the following code should
do it for you:

Workbooks.Open "FileName"

where "FileName" is the name of whatever file you want to open.

"David" wrote:

No kiddin Sherlock!
You must be a democrat...pointing out the negative with no solution.

"Lucas Swanson" wrote:

That is not the way GetOpenFilename works. GetOpenFilename launches a dialog
box asking the user to select which files should be opened.

"David" wrote:

Do you know anyway when using the Application.GetOpenFilename function to use
a specific filename that is a defined string?
Example: SName is BP-Sarasota.xls
Tried fname=Application.GetOpenFilename(SName) but no joy.
Any ideas?

David

"Bernie Deitrick" wrote:

Here's the general idea:

Sub OpenUserSelectedFiles()
Dim i As Integer
Dim filearray As Variant

filearray = Application.GetOpenFilename( _
Title:="Select the files to process", MultiSelect:=True)
If IsArray(filearray) Then
For i = LBound(filearray) To UBound(filearray)
Workbooks.Open filearray(i)
'Call your macro here
ActiveWorkbook.Close False
Next i
Else:
MsgBox "You clicked cancel"
End If
End Sub

HTH,
Bernie
MS Excel MVP


"SVTman74" wrote in message
...
Open a file do a macro ( made) and open next succesive file

File name yyyy-mm-ddxxxx.csv <--- the date is the creation date.
can I have excel run the macro to auto matically open first file in dir run
its parse and save ( this is done) THEN open the next file and continue?





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
Open Excel file from VB and open MACRO no1jimmyman Excel Discussion (Misc queries) 0 February 14th 11 10:10 PM
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
can I open a excel file made on a XLcomp W/A vistacomp. MSWord? Bradley763 Excel Discussion (Misc queries) 2 May 31st 08 03:40 PM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 12:46 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"