Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

OnOpen Macro not running through QEMC

Hi all

I hope someone can help me.

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:

Sub Movefiles()

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

End If

If Right(OldPath1, 1) <> "\" Then

OldPath1 = OldPath1 & "\" & Fileprefix1

End If

Set FileSysObj = CreateObject("Scripting.FileSystemObject")

FileSysObj.MoveFile OldPath, Newpath

FileSysObj.MoveFile OldPath1, Newpath

End Sub

Many thanks.

Justine

1 Solution

Accepted Solutions
arieidel
Partner - Creator II
Partner - Creator II

From de QV Load Script you can type an EXECUTE sentence to execute a DOS command through a .cmd or a .bat files.

View solution in original post

5 Replies
Alexander_Thor
Employee
Employee

Hey Justine,

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.

Not applicable
Author

Thanks for the speedy response Alexander.

I shall check what you have suggested and post back here tomorrow.

Justine

jerrysvensson
Partner - Specialist II
Partner - Specialist II

OnOpen macro will not trigger in Publisher.

If you want your files to be copied during loading it is better to call the macro from the script.

Alexander has a point also. Never use mapped drive, use UNC path instead.

arieidel
Partner - Creator II
Partner - Creator II

From de QV Load Script you can type an EXECUTE sentence to execute a DOS command through a .cmd or a .bat files.

Not applicable
Author

Thanks for all helpful answers.