Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
johnan
Creator III
Creator III

VBA And Macro

Hi all, i have a simple VBA file to reload an application.

In this QV i have a macro that export some images. The problem is it won't run the macro right, it's just open the macro window.

So my question is  there is possible to run this macro in the VBS fil?

Export images into a location in the computer?

Br

 

5 Replies
m_woolf
Master II
Master II

It's really hard to answer this question without seeing the macro code.

johnan
Creator III
Creator III
Author

Here you go!

function exportImages
' Test if export should be made
set v = ActiveDocument.Variables("RunNow")
if v.GetContent.String = "Yes" then
v.SetContent "No",true
exportAll
ActiveDocument.GetApplication.Quit
end if
end function

function exportAll
export("CH97")
export ("TX09")
end function

function export(chartId)
set obj = ActiveDocument.GetSheetObject(chartId)
obj.ExportBitmapToFile "C:\inetpub\wwwroot\as400\UTL\Chart_" & chartId & ".png"
end function

jaibau1993
Partner - Creator III
Partner - Creator III

Hi! if the macro window is opened when you run it it is because there is an error in your code. You can use the "test" button to locate the error and get some info:


testVBS2.png

 

On the other hand, yes, what you need can be done. I checked your code and it runs perfectly in my computer. Check objects IDs, check that those objects are visible, check the path where you save the pics and verify that you allow system acces

testVBS.png

Regards,

Jaime. 

johnan
Creator III
Creator III
Author

I have testit, and get memory problems and strange errors.. Sometime it works, sometime not.

Can i run a batfile? Like this. 

"C:\Program Files\QlikView\Qv.exe" /I /r "C:\Qv\ManifestOrdersBILD.qvw"

 

If i run above, the qlikview will not reload it 😞

Brett_Bleess
Former Employee
Former Employee

Johnan, I believe the /r and /l are mutually exclusive, one or the other in regard to those, I will try to confirm, but I suspect that is why things are not working for you, if you do one or the other there, I suspect that should get things working.

https://help.qlik.com/en-US/qlikview/April2019/Subsystems/Client/Content/QV_QlikView/Starting_QlikVi...

I am going to submit a doc defect regarding the fact this is not clear in the Help, but I did confer with a coworker and he thought the same thing, so I am pretty sure we are correct here, you have to use the /r or /l...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.