#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default P

Dear All,

I am using following to apply macro on all files in a folder. on close of
everyfile the msg box appear, you want to save and three option Yes No
Cancel. How its possible that all the files saves and go on next file without
appearing any msg box?

Your help required with thnx



Sub list_um()
Dim F As String
Dim roww As Long
roww = 0
Dim FileLocSpec As String
FileLocSpec = "C:\Hassan\*.csv"
F = Dir(FileLocSpec)
Do Until F = ""
roww = roww + 1
Cells(roww, 1).Value = F
F = Dir
Loop

Set r = Range("A1")
While r.Value < ""
Workbooks.Open Filename:="C:\Hassan\" & r.Value
Call Wathba
ActiveWorkbook.Save
ActiveWorkbook.Close

Set r = r.Offset(1, 0)
Wend
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default P

Instead of
ActiveWorkbook.Save
ActiveWorkbook.Close

use

ActiveWorkbook.Close SaveChanges:=True

"TFMR" wrote:

Dear All,

I am using following to apply macro on all files in a folder. on close of
everyfile the msg box appear, you want to save and three option Yes No
Cancel. How its possible that all the files saves and go on next file without
appearing any msg box?

Your help required with thnx



Sub list_um()
Dim F As String
Dim roww As Long
roww = 0
Dim FileLocSpec As String
FileLocSpec = "C:\Hassan\*.csv"
F = Dir(FileLocSpec)
Do Until F = ""
roww = roww + 1
Cells(roww, 1).Value = F
F = Dir
Loop

Set r = Range("A1")
While r.Value < ""
Workbooks.Open Filename:="C:\Hassan\" & r.Value
Call Wathba
ActiveWorkbook.Save
ActiveWorkbook.Close

Set r = r.Offset(1, 0)
Wend
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



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