Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Execute macro from script

Hello. I want to load data from 1C (Russian ERP). So, I use this macro:

sub v82query

Dim ServerName

Dim InfoBaseName

Dim InfoBasesAdminName

Dim InfoBasesAdminPass

ServerName = ""

InfoBaseName = "

InfoBasesAdminName = "

InfoBasesAdminPass = ""

set conn = CreateObject("V83.COMConnector.1")

Set v82 = conn.Connect("Srvr=""" + ServerName + """;Ref=""" + InfoBaseName + """;Usr=""" + InfoBasesAdminName + """;Pwd=""" + InfoBasesAdminPass + """;")

query_1c = "ВЫБРАТЬ" &_

" Представление(цТребованиеНакладнаяДляСХМатериалы.Поле) Как  Pole"& vbNewLine & _

"ИЗ"& vbNewLine & _

" Документ.цТребованиеНакладнаяДляСХ.Материалы КАК цТребованиеНакладнаяДляСХМатериалы " & vbNewLine & _

set v8query = v82.NewObject("Query")

v8query.text = query_1c

set result = v8query.Execute

set m = result.Choose

do while m.next

set sql_string = ActiveDocument.DynamicUpdateCommand("INSERT INTO * "& vbNewLine & _

"(Pole) " & vbNewLine & _

"VALUES (" & m.Pole &")")



end sub

And I use a simple script:





left join


LOAD  C as Pole


And I want to call my macro from script, because I try to dynamic update Table1 and left join Table2.

Please, help me, how to call my macro from my script before left join?

3 Replies

Re: Execute macros from script

Unfortunately, that will not work. You cannot call macro subs from the load script. You can use macro functions in a load statement (with some limitations), but I don't think that will help in this case.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

Re: Execute macros from script

It may be possible to put your macro into a .vbs statementfile, and execute the macro using cscript.exe in a batch file. You will need to drop the ActiveDocument.GetApplication.Refresh statement and reload the document from the same batch file using the qv.exe /R option.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable

Re: Execute macro from script

OK, thank you. I think that I need  try another way. I want to load data from ERP to one qlik app, and in the another app open it and join tables from Excel.

Community Browser