Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
salezian
Creator
Creator

Macros on server

Hi Everyone

I'm trying to reload using scheduler QlikView document containing two macros. Macros are used to count files in folder and delete files. Here is example of macro's code:

public function DeleteFile(filePath)

   Set objFSO = CreateObject("Scripting.FileSystemObject")

   Dim retVal 'as Boolean

   If objFSO.FileExists(filePath) Then

      Call objFSO.DeleteFile(filePath)

      retVal = true

   Else

Set objFSO = nothing

      retVal = false

   End If

   DeleteFile = retVal

end function

Locally those macros work fine. But when document is refreshed by scheduler I got general error as a result.

Is there any workaround to launch document on server ?

Regards.

M

13 Replies
salezian
Creator
Creator
Author

When I reload it by opening document and hitting ctrl + R.

whiteline
Master II
Master II

Hi.

Have you checked a simple function containing one line 'DeleteFile = true' ?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The CreateObject("Scripting.FileSystemObject") call requires your module to have System Access. To get System Access from the command line, you have to add the switch /NoSecurity.

QV.exe /r /NoSecurity path_to_qv_file


-Rob

http://masterssummit.com

http://robwunderlich.com



salezian
Creator
Creator
Author

Thanks Rob,

Now it works like a charm.