Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro not working when reloading from command line

Hi all,

this is a very weird situation.

I have a simple script to export a csv file that is called  when OnPostReload event is fired.

Sub ExportToCSV

  set sObject1 = ActiveDocument.GetSheetObject("ClientiUnivoci")

  sObject1.Export "Output\ClientiUnivoci_Week_" & Year(Now()) & LPad(Month(Now()),"0",2 ) & LPad(Day(Now()),"0",2 ) & ".csv", ";", 65001

End Sub

When I launch reload inside qlikview the script works fine and the file is generated, when I lanch qlikview reload from a batch file using the following command:

"C:\Program Files\QlikView\Qv.exe" /r "C:\Qlikview\Project\LastWeek.qvw"

the qlikview file is reload but the macro is not executed and the csv file is not generated.

I made the following attemps without success:

  • "C:\Program Files\QlikView\Qv.exe" /r /NoSecurity "C:\Qlikview\Project\LastWeek.qvw"
  • Settings | Document Properties | Security -> All checked except Allow Print, Show All Sheets and Objects and Show Progress for Hidden Script
  • Settings | User preferences | Security -> All checked except Confirm Launch from Macro
  • Tools | Edit Module | Request Module Security -> System Access
  • Tools | Edit Module | Current Local Security -> Allow System Access
  • Run batch as Administrator

I don't really know what to do more.

Do you have any ideas?

Thanks in advance.

Nicola


1 Solution

Accepted Solutions
marcus_sommer

Mostly it are the small things ...

View solution in original post

13 Replies
SreeniJD
Specialist
Specialist

Hi Nicola,

I guess, you can execute through windows batch file. Btw, do you have QV server?

Execute cmd.exe /C C:\BatFiles\Example.bat


Regards,

Sreeni

Not applicable
Author

I'm already using a Windows bat file.

The bat file contains the following code:

"C:\Program Files\QlikView\Qv.exe" /r "C:\Qlikview\Project\LastWeek.qvw"

When I run the bat file qlikview reloads correctly but the macro is not executed.

I don't have QV server.

Thanks.

SreeniJD
Specialist
Specialist

Hi Nicola,

Your windows bat file script is correct..

cd "C:\Program Files\Qlikview\Qv.exe" /r "C:\Qlikview\Project\LastWeek.qvw"

I wondering, is there any service that is down causing the issue.. Can you please check the services in Control panel?

Regards,

Sreeni

Not applicable
Author


Hi Sreeni, first of all thanks for your help.

I don't believe it's a problem of services, I copied the qlikview file on another machine and the issue remains exactly the same. Furthermore on the same machine I have lot of other qvw files that work in the same manner called by a batch file. So I don't really understand where the problem could be. If I'll find out a solution I will post it,

any other idea is appreciated.

Thanks a lot.

Nicola

marcus_sommer

Make a try with /l as parameter:

"C:\Program Files\QlikView\Qv.exe" /l "C:\Qlikview\Project\LastWeek.qvw"

- Marcus

Not applicable
Author

Done. The QV file remains open but the macro in not executed.

Thanks

marcus_sommer

Check this too: Settings | User preferences | Security -> All checked except Confirm Launch from Macro

Not applicable
Author

Nothing to do.

Thanks the same Marcus.


marcus_sommer

But in general this approach worked - I do the same since years. How do you execute the batch - as normal windows user which clicked on the batch within the explorer quite similar you open the qvw itself to start the reload or is this different from them?