Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
joaquinlr
Valued Contributor II

Macro that runs in Load Script but not in Reload with QMC

Hi guys:

I have a macro function with a param that works fine in Desktop Load Script but it doesn't when reload from QMC, I don't know how to solve it,

This is the macro:

function open_and_save (vFile)

open_and_save = "Inicial"

' Definir el objeto de tipo Aplicación Excel con los parámetros básicos ...

set xlApp = CreateObject("Excel.Application")

xlApp.Visible = false

xlApp.ScreenUpdating = false

xlApp.DisplayAlerts = false

' Definir el objeto libro excel y abrír el fichero ...

xlApp.Workbooks.Open vFile   

Set xlDoc = xlApp.Workbooks(1)

' Guardar y cerrar fichero, Salir de la aplicación ...

xlDoc.Save

xlDoc.Close

xlApp.Quit

' Borrar objetos libro y aplicación ...

set xlDoc = nothing

set xlApp = nothing

open_and_save = "Correcto"

end function

And this is the call to the macro

     LET vRes = open_and_save(vAttachPath);

When I run it with Desktop the value of vRes  is 'Correcto' but when QMC runs the script it fails and this text is in the log file


Error: Unexpected token: '(', expected one of: ':', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', 'like', ...

Any suggest will be appreciated

Thanks in advanced,

Joaquin

1 Reply
andrey_krylov
Valued Contributor

Re: Macro that runs in Load Script but not in Reload with QMC

As I know it's not possible from QMS