Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I need your help and I hope someone can help to me.
I´m trying to run a macro that switch different sheets on the qvw but the macro doesnt run. Then I tried with variables and the conditional statements on every sheet but it doesnt work.
This is the macro:
SUB ActivaHoja
For i= 1 to 50000
ActiveDocument.Sheets("Portada").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 5000
ActiveDocument.Sheets("Proporción").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 5000
ActiveDocument.Sheets("Proporción Imp").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 5000
ActiveDocument.Sheets("Detalle").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 5000
ActiveDocument.Sheets("Año Mes").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 5000
NEXT
END SUB
Does it work when you run it manually ?
With me this works manually but not on the server.
=====================
FUNCTION ExportObjectToJpg(SheetID, ObjID, fName)
set s=ActiveDocument.GetSheetById(SheetID)
set sp=s.GetProperties
sp.Show.Always = true
s.SetProperties sp
s.Activate
for i=0 to s.NoOfSheetObjects-1
if s.SheetObjects(i).GetObjectId = ObjID then
ActiveDocument.GetApplication.WaitforIdle
s.SheetObjects(i).ExportBitmapToFile fName
end if
next
END FUNCTION
SUB CallExample
set ss= ActiveDocument.GetSheet(2)
ExportObjectToJpg "Document\SH03", "Document\CH01", "U:\Calls_650.jpg"
ActiveDocument.GetApplication.Sleep 2000
set ss= ActiveDocument.GetSheet(3)
ExportObjectToJpg "Document\SH04", "Document\CH04", "U:\Calls_651.jpg"
ActiveDocument.GetApplication.Sleep 2000
set ss= ActiveDocument.GetSheet(4)
ExportObjectToJpg "Document\SH05", "Document\CH05", "U:\Calls_652.jpg"
END SUB
Hi,
Did you try to run via IE Pluggin.
With ajax macros does not work.
Regards
ASHFAQ
You can try to do this with a script outside of Qlikview.
This works with me (automaticly)
Here a part of the script
+++++++++++++++++++++++++++
'Initialyze the Variables
Set Qv = CreateObject("QlikTech.QlikView")
Set QvDoc = Qv.OpenDoc("Open_document", "User", "Password")
Set ActiveDocument = QvDoc
QvDoc.Reload
QvDoc.GetApplication.WaitForIdle 'Application Waits till responding
QvDoc.Save
QvDoc.GetApplication.WaitForIdle
WScript.Sleep 2000 'Application Waits 2 seconds
'Application Selects the Chart and exports this to a Picture
ActiveDocument.GetSheetByID("SH01").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("CH01").ExportBitmapToFile "C:\temp\Filename_1.jpg"
WScript.Sleep 2000
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetByID("SH02").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("CH04").ExportBitmapToFile "C:\temp\Filename_2.jpg"
WScript.Sleep 2000
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetByID("SH05").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetSheetObject("CH05").ExportBitmapToFile "C:\temp\Filename_3.jpg"
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Quit
++++++++++++++++++++++++
This script is started from task scheduler in Windows