Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
souadouert
Specialist
Specialist

Create folder with macro


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

1 Solution

Accepted Solutions
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

View solution in original post

1 Reply
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