P

T

TFMR

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
 
S

Sheeloo

Instead of
ActiveWorkbook.Save
ActiveWorkbook.Close

use

ActiveWorkbook.Close SaveChanges:=True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top