5 Replies Latest reply: Dec 11, 2013 5:20 AM by Justine Binnall RSS

    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.