I have a qlikview document with an onopen macro. This macro simply moves some files from one location to another and then closes the document. This works fine when I manually open the document. When I schedule it to run (or click on run) from the Qlikview Enterprise Management Console, the macro doesn't seem to run.
Can anyone suggest why this may be and what I can do to correct it?
This is the part of the macro that moves the files:
Dim OldPath, OldPath1, NewPath, Fileprefix, Fileprefix1, FileSysObj
On Error Resume Next
OldPath = "Z:\QlikView_SourceDocs_V10\Additional Data Sources\Text"
OldPath1 = "Z:\QlikView_SourceDocs_V10\Additional Data Sources\Text"
NewPath = "Z:\QlikView_SourceDocs_V10\Additional Data Sources\Text\HIST"
Fileprefix = "TDH_AR_HIST_*"
Fileprefix1 = "TDH_TM_201*"
If Right(OldPath, 1) <> "\" Then
OldPath = OldPath & "\" & Fileprefix
If Right(OldPath1, 1) <> "\" Then
OldPath1 = OldPath1 & "\" & Fileprefix1
Set FileSysObj = CreateObject("Scripting.FileSystemObject")
When QEMC/Publisher executes a macro it does so as the user that is running the Publisher service.
Make sure that the user has access to the folder where you are accessing files and also that the Z: drive is a valid path for that user. Most likely if you have never logged on with that user the mapping won't exists so you might want to go with the full folder name instead.
When you are reloading the document locally you are executing the macro as your user.
Also make sure that the macro has full system access and that the server is allowed to execute macros.