1 Reply Latest reply: Feb 22, 2018 7:58 AM by Marcus Sommer RSS

    Create folder with macro

    souad ouertani

      I used this macro to create folder and i give the system access , But the folder didnt create and i have not any error

      SUB folder()


      set Var = ActiveDocument.GetVariable("D:\TEST")

      dim filesys, newfolder, newfolderpath

      newfolderpath = Var.GetContent.String

      set filesys=CreateObject("Scripting.FileSystemObject")

      If Not filesys.FolderExists(newfolderpath) Then

         Set newfolder = filesys.CreateFolder(newfolderpath)

         msgbox("A new folder has been created at: " & newfolderpath)

      End If

      END SUB

        • Re: Create folder with macro
          Marcus Sommer

          Are you sure that you have variable with the name of "D:\TEST" and that they contained a valid path? I assume that this is rather your aimed target-path and not a variable. Therefore go into the gui and create there a variable maybe "FolderPath" and assign "D:\TEST" as value and it should work with:


          set Var = ActiveDocument.GetVariable("FolderPath")


          - Marcus