Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Macro not working when executed through task

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

//chesterluck

16 Replies
Anonymous
Not applicable
Author

Thats the err.num & desc:

462 - remote server machine not found

Anonymous
Not applicable
Author

I'll check it - sounds plausible.

Maybe this raw somehow creates a problem: AppExcel.Visible = true???

jerrysvensson
Partner - Specialist II
Partner - Specialist II

Maybe, try to remove it. 🙂

Anonymous
Not applicable
Author

XLSimport = "\\server\import.xlsx"

Set AppExcel = CreateObject("Excel.Application")
AppExcel.Visible = False
Set objXLS = AppExcel.Workbooks.Open(XLSimport)

'-----------------------------------------------------------------------------------------------------------------Parameter set

Set curSheet_St = AppExcel.WorkSheets(1)

'-----------------------------------------------------------------------------------------------------------------Clear

curSheet_St.Range("B4:I17").ClearContents

AppExcel.Sheets("Import_QV").Range("A1:F11").ClearContents
Set GraphNumToExport_St = ActiveDocument.GetSheetObject("CH49") 
GraphNumToExport_St.CopyTableToClipboard true



curSheet_St.Paste curSheet_St.Range("B4")  

So tell me once again - and forgive me for many stupid questions - how can I make this code work? You mean that this can't work: Set objXLS = AppExcel.Workbooks.Open(XLSimport)?

Thanks in advance

//chesterluck

jerrysvensson
Partner - Specialist II
Partner - Specialist II

If this Run macro from server

doesn't work, I can't help you. We are facing a similar problem..

Have you tried this?

Set up a scheduled task like this:

"c:\program files\qlikview\qv.exe" /r yourapp.qvw

Location of qv.exe might be different.

Anonymous
Not applicable
Author

C:

CD C:\Program Files\QlikView Desktop\

Qv.exe /r D:\QlikView\Documents\sth.qvw

Taskkill Qv.exe

EXIT

Well this im doing already. The error from error handling is this

462 - Remote server machine not found