Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using Script to execute macro function that Creates Folder

Hi Guys,

I wrote a macro that creates a folder into a specific location.

When Testing (with Debug) the macro in QV, it works, and the folder is created.

Now, I need to somehow call the function during script execution.

I tried something like below, but it isn't working.

How can I work it around?

Thanks in advance,

Aldo.


Sub CreateFolder

fsoCreateFolder()

End Sub

Call CreateFolder;

Function fsoCreateFolder()

Dim objFSO

Dim objFolder

Dim Overwrite

Dim FolderName: FolderName = "BKS11"

Dim FolderPath: FolderPath = "C:\Temp"

Set objFSO = CreateObject("Scripting.FileSystemObject")

Overwrite = objFSO.FolderExists(FolderPath & "" & FolderName)

Select Case Overwrite

Case False: Set objFolder = objFSO.CreateFolder(FolderPath & "" & FolderName)

Case Else

End Select

Set objFSO = Nothing: Set objFolder = Nothing

End Function

'----------------------



1 Solution

Accepted Solutions
Not applicable
Author

The function below (and the call) are actually working.

Thanks,

Aldo.

Function fsoCreateFolder(FolderPath, FolderName) '(FolderName, FolderPath)

'Function Tested!

'Call the function as below:

'load fsoCreateFolder('$(vRootDir)', 'Created Folder No 1') autogenerate 1;

Dim objFSO

Dim objFolder

Dim Overwrite

Set objFSO = CreateObject("Scripting.FileSystemObject")

Overwrite = objFSO.FolderExists(FolderPath & "\" & FolderName)

Select Case Overwrite

Case False: Set objFolder = objFSO.CreateFolder(FolderPath & "\" & FolderName)

Case Else

End Select

Set objFSO = Nothing: Set objFolder = Nothing

End Function



View solution in original post

3 Replies
Not applicable
Author

Try something like that:

let someVariable = fsoCreateFolder();

Read more detail in:

QlikView\Documentation\QlikView Reference Manual.pdf

:Book II

:28 VBSCRIPT FUNCTION CALLS FROM SCRIPT

page 855

Not applicable
Author

Thanks.

Not applicable
Author

The function below (and the call) are actually working.

Thanks,

Aldo.

Function fsoCreateFolder(FolderPath, FolderName) '(FolderName, FolderPath)

'Function Tested!

'Call the function as below:

'load fsoCreateFolder('$(vRootDir)', 'Created Folder No 1') autogenerate 1;

Dim objFSO

Dim objFolder

Dim Overwrite

Set objFSO = CreateObject("Scripting.FileSystemObject")

Overwrite = objFSO.FolderExists(FolderPath & "\" & FolderName)

Select Case Overwrite

Case False: Set objFolder = objFSO.CreateFolder(FolderPath & "\" & FolderName)

Case Else

End Select

Set objFSO = Nothing: Set objFolder = Nothing

End Function