Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Macro outside qvw

Hi All,

Calling macro outside the qvw file,  is it supported? If yes please suggest how to call,  if my macro code reside in a text file.

Thanks in advance.

2 Replies
MVP
MVP

Macro outside qvw

Interesting question. In theory, it should be possible, with some limitations and a little complexity:

  1. The macro code is VB script or Javascript, so you can run it in cscript. If you don't know what cscript is, then the external macro is not the way to learn.
  2. You will be able to invoke Subs but not functions. In particular, you will not be able to use macro functions from your load script.
  3. You can call functions from the load script using EXTERNAL to invoke the cscript, or from a normal macro be creating a shell object to do the same. You will not be able to return anything to your Qlikview model.
  4. The external macro would have no knowledge of your model, so it will not be able to manipulate objects or process any data from the model. It could open and manipulate a copy of the model.

I am curious why you would want to do this. It is unfortunately not a practical way to 're-use' the code.

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
stephen-a_redmo
Valued Contributor II

Macro outside qvw

Hi,

You can run VBScript externally to QlikView, no problem.

You need to createobject to QlikTech.QlikView.  This will open QlikView if it is not open.

Note that you will need to have a named user CAL for this to work on your files.

For example:

Dim Application

Set Application=CreateObject("QlikTech.QlikView")

 

Application.OpenDoc "C:\temp\test.qvw"

Regards,


Stephen

Community Browser