16 Replies Latest reply: Nov 6, 2013 2:42 PM by Michael Ionkin RSS

    Macro not working when executed through task

    Michael Ionkin

      Hello community,


      I'm standing infront of a quite special problem. I have a file which is starting a skript triggered by opening this file.

      The file is opened by a task which is opening a batch.


      The macro itself starts first a batch and the it is doing some excel operations:


      'BAT operation

          MoveXLS = "D:\tasks\some.bat"

          Set ShellApp = CreateObject("Shell.Application")

                      ShellApp.Open (MoveXLS)

                      ActiveDocument.getApplication.sleep 20000

                      Set ShellApp = Nothing


      'Excel operation

      XLSimport = "\\server\import.xlsx"

      Set AppExcel = CreateObject("Excel.Application")

      AppExcel.Visible = True

      Set objXLS = AppExcel.Workbooks.Open(XLSimport)




      When the file was opened through the task then the Macro is only doing the batch operation.

      When im starting the batch manually then everything is working.


      I don't know what is the reason for this issue.

      Other triggers are working fine, for instance when I want to save a table in an xle format.


      Until now it is the first time im using vb to CreateObject("Excel.Application").

      I suppose somewhere here the root of the problem must be...


      Thank you in advance