ich habe von der aktiver Zelle die Datei (C:\Lokal\Sergej\ID-Nummer.MA per CMD an 20 Standorte kopiert. Die Attribute der Zieldatei habe ich vor und nach dem Kopiervorgang geändert. Die Dateiattribute zu ändern dauert länger als die Datei zu kopieren. Lässt sich bitte der untere Code grundsätzlich per VBA vereinfachen/optimieren?
Sub START_MAKROS()
Dim strFile As String
strFile = Environ("Temp") & "\" & Format(Now, "YYYY-MM-DD_HH_MM_SS") & "_copy.cmd"
Open strFile For Output As #1
Print #1, "color 17"
Print #1, "chcp 65001"
Print #1, "cls"
Print #1, "attrib -r -s -h /S /D "; """"; "P:\Daten\DE-WUP01\Einstellungen\Nova\ _
Standards\makros\" & ActiveCell.Offset(0, 1); """"
Print #1, "attrib -r -s -h /S /D "; """"; "P:\Daten\DE-KAM16\Einstellungen\Nova\ _
Standards\makros\" & ActiveCell.Offset(0, 1); """"
Print #1, "attrib -r -s -h /S /D "; """"; "P:\Daten\DE-TES04\Einstellungen\Nova\ _
Standards\makros\" & ActiveCell.Offset(0, 1); """"
'usw.
Print #1, "xcopy "; """"; ActiveCell; """"; " "; """"; "P:\Daten\DE-WUP01\Einstellungen\ _
Nova\Standards\makros\"; """"; " /Y"
Print #1, "xcopy "; """"; ActiveCell; """"; " "; """"; "P:\Daten\DE-KAM16\Einstellungen\ _
Nova\Standards\makros\"; """"; " /Y"
Print #1, "xcopy "; """"; ActiveCell; """"; " "; """"; "P:\Daten\DE-TES04\Einstellungen\ _
Nova\Standards\makros\"; """"; " /Y"
'usw.
Print #1, "attrib +r +s +h /S /D "; """"; "P:\Daten\DE-WUP01\Einstellungen\Nova\ _
Standards\makros\" & ActiveCell.Offset(0, 1); """"
Print #1, "attrib +r +s +h /S /D "; """"; "P:\Daten\DE-KAM16\Einstellungen\Nova\ _
Standards\makros\" & ActiveCell.Offset(0, 1); """"
Print #1, "attrib +r +s +h /S /D "; """"; "P:\Daten\DE-TES04\Einstellungen\Nova\ _
Standards\makros\" & ActiveCell.Offset(0, 1); """"
'usw.
Close #1
End Sub
Beste Grüße,Sergej