Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default LoopFolder Macro Save as

Sorry for my duplicate post if any is showing. I am not seeing any
of my
post so I am attempting again...


This macro has been quite handy for me but I still have to manually
click "yes" to save changes for each file after data has been
prepped. What
can I add to eliminate the save as prompt. Thanks for any help in
advance.



Dim aryFiles
Dim oFSO
Sub LoopFolders_Cincinnati()
Dim i As Integer


Set oFSO = CreateObject("Scripting.FileSystemObject")


selectFiles "C:\Documents and Settings\TRACKERS\DATA "


Set oFSO = Nothing


End Sub


'--------------------------------------------------------------------------**-
Sub selectFiles(sPath)
'--------------------------------------------------------------------------**-
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr


Set Folder = oFSO.GetFolder(sPath)


For Each fldr In Folder.Subfolders
selectFiles fldr.Path
Next fldr


For Each file In Folder.Files
If file.Type = "Microsoft Excel Comma Separated Values File"
Then
Workbooks.Open Filename:=file.Path
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Cells.Select
Selection.Sort Key1:=Range("BW2"), Order1:=xlDescending,
Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal


ActiveWorkbook.Save
ActiveWorkbook.Close
End If
Next file


End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default LoopFolder Macro Save as

I think what you want is this near the End If statement in the
selectFiles(sPath) routine:

Application.DisplayAlerts = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.DisplayAlerts = True
End If

"simplymidori" wrote:

Sorry for my duplicate post if any is showing. I am not seeing any
of my
post so I am attempting again...


This macro has been quite handy for me but I still have to manually
click "yes" to save changes for each file after data has been
prepped. What
can I add to eliminate the save as prompt. Thanks for any help in
advance.



Dim aryFiles
Dim oFSO
Sub LoopFolders_Cincinnati()
Dim i As Integer


Set oFSO = CreateObject("Scripting.FileSystemObject")


selectFiles "C:\Documents and Settings\TRACKERS\DATA "


Set oFSO = Nothing


End Sub


'--------------------------------------------------------------------------Â*Â*-
Sub selectFiles(sPath)
'--------------------------------------------------------------------------Â*Â*-
Dim Folder As Object
Dim Files As Object
Dim file As Object
Dim fldr


Set Folder = oFSO.GetFolder(sPath)


For Each fldr In Folder.Subfolders
selectFiles fldr.Path
Next fldr


For Each file In Folder.Files
If file.Type = "Microsoft Excel Comma Separated Values File"
Then
Workbooks.Open Filename:=file.Path
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Cells.Select
Selection.Sort Key1:=Range("BW2"), Order1:=xlDescending,
Header:=xlGuess _
, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal


ActiveWorkbook.Save
ActiveWorkbook.Close
End If
Next file


End Sub


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
Loopfolder macro simplymidori Excel Discussion (Misc queries) 1 July 18th 07 08:33 AM
loopfolder macro simplymidori Excel Discussion (Misc queries) 1 July 18th 07 08:33 AM
Loopfolder macro simplymidori Excel Discussion (Misc queries) 0 July 18th 07 03:44 AM
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM
Save as Macro MikeD1224 Excel Discussion (Misc queries) 1 February 16th 07 11:08 PM


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