Sub main() '************************************************************************************************************************* ' Basierend auf dem "Create folder" Script von vpt.se und chadjac ' Based On the "Create folder" script from vpt.se und chadjac ' https://www.pcdmisforum.com/forum/pc-dmis-enterprise-metrology-software/pc-dmis-code-samples/8758-create-folder-script '************************************************************************************************************************* '------------------------------------------------------------------------------------------------------------------------- ' Erstellt die Objekte ' Create the objects '------------------------------------------------------------------------------------------------------------------------- Dim pcdapp As Object Set pcdapp = createobject("pcdlrn.application") Dim pcdpartprogram As Object Set pcdpartprogram = pcdapp.activepartprogram Dim fso As Object Set fso = createobject("scripting.filesystemobject") '------------------------------------------------------------------------------------------------------------------------- ' Definiert das Hauptverzeichniss für den Protokoll Speicherpfad ' Defines the root folder for the protocol path '------------------------------------------------------------------------------------------------------------------------- strpath = "W:\TEST\10_Messprotokolle\" 'MsgBox(strpath) '------------------------------------------------------------------------------------------------------------------------- ' Findet die PC-DMIS Variablen für den Protokoll Speicherpfad ' Gets the PC-DMIS variables for the protocol path '------------------------------------------------------------------------------------------------------------------------- Dim artikel As Object Set artikel = pcdpartprogram.getvariablevalue("V_ARTIKEL") strartikel = artikel.stringvalue 'MsgBox(strartikel) Dim pa As Object Set pa = pcdpartprogram.getvariablevalue("V_PA") strpa = pa.stringvalue 'MsgBox(strpa) Dim operation As Object Set operation = pcdpartprogram.getvariablevalue("V_OPERATIONSSCHRITT") stroperation = operation.stringvalue 'MsgBox(stroperation) '------------------------------------------------------------------------------------------------------------------------- ' Prüft ob der Protokoll Speicherpfad existiert & erstellt ihn wenn nicht ' Checks If the protocol path exists and creates it If Not '------------------------------------------------------------------------------------------------------------------------- Dim fsofolder As Object If Not fso.folderexists(strpath) Then Set fsofolder = fso.createfolder(strpath) End If strpath = strpath & "\" & strartikel 'MsgBox(strpath) If Not fso.folderexists(strpath) Then Set fsofolder = fso.createfolder(strpath) End If strpath = strpath & "\" & strpa 'MsgBox(strpath) If Not fso.folderexists(strpath) Then Set fsofolder = fso.createfolder(strpath) End If strpath = strpath & "\" & stroperation 'MsgBox(strpath) If Not fso.folderexists(strpath) Then Set fsofolder = fso.createfolder(strpath) End If '------------------------------------------------------------------------------------------------------------------------- ' Räumt auf ' Tidies up '------------------------------------------------------------------------------------------------------------------------- Set fso = Nothing Set pcdpartprogram = Nothing Set pcdapp = Nothing End Sub