'** (1)
Sub test()
Dim MDoc As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set MDoc = Workbooks.Open(Filename:="H:AAABBBCCCMIODOCMiodoc.xls", Password:="mauro")
If Not MDoc Is Nothing Then
With MDoc
With .Sheets(.Sheets.Count)
.Cells(.Rows.Count, .Columns.Count) = "File1"
End With
.SaveAs Filename:="H:Miodoc.xls", FileFormat:=xlNormal, Password:="mauro"
With .Sheets(.Sheets.Count)
.Cells(.Rows.Count, .Columns.Count) = "File2"
End With
.SaveAs Filename:="D:Miodoc.xls", FileFormat:=xlNormal, Password:="goal"
End With
MDoc.Close
Set MDoc = Nothing
End If
Application.ScreenUpdating = False
Application.DisplayAlerts = False
End Sub
'__________________________________________________________________
'** (2)
Private Sub Workbook_Open()
With ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
If .Cells(.Rows.Count, .Columns.Count) = "File1" Then
Macro1 'esegui le macro per File1
Macro2
'Eccetera...
ElseIf .Cells(.Rows.Count, .Columns.Count) = "File2" Then
Macro3 'esegui le macro per File2
Macro4
'Eccetera...
End If
End With
End Sub
|