Sub Posso()
Dim percorso As String, Nome As String
Dim Oggetto As Object, Cartella As Object, File_excel As Object
Application.ScreenUpdating = False
percorso = ThisWorkbook.Path
Set Oggetto = CreateObject("Scripting.FileSystemObject")
Set Cartella = Oggetto.GetFolder(percorso)
Formula = "mario.rossi@tin.it"
On Error GoTo prossimo
For Each File_excel In Cartella.Files
Nome = File_excel.Name
If File_excel.Name <> ThisWorkbook.Name Then
Workbooks.Open(percorso & "" & Nome).Sheets("Vuoto").Range("A2").Formula = "mario.rossi@tin.it"
ActiveWorkbook.Close True
End If
Formula = "=Vuoto!a1"
On Error GoTo prossimo
Nome = File_excel.Name
If File_excel.Name <> ThisWorkbook.Name Then
Workbooks.Open(percorso & "" & Nome).Sheets("Vuoto").Range("A3").Formula = "=vuoto!a1"
ActiveWorkbook.Close True
End If
prossimo:
Next
Application.ScreenUpdating = True
MsgBox "Formule inserite!"
End Sub
|