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 strartikel As Object Set strartikel = pcdpartprogram.getvariablevalue("V_ARTIKEL") 'MsgBox(strartikel) Dim strpa As Object Set strpa = pcdpartprogram.getvariablevalue("V_PA") MsgBox(strpa) Dim stroperation As Object Set stroperation = pcdpartprogram.getvariablevalue("V_OPERATIONSSCHRITT") 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