Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to create a macro to export a chart as a JPG file.
From within the Edit Script (Ctrl-E) I have added a new tab and entered the following
FUNCTION ExportObjectToJpg( ObjID, fName)
ActiveDocument.GetSheetObject(ObjID).ExportBitmapToFile fName
END FUNCTION
SUB CallExample
ExportObjectToJpg "CH01", "C:\CH01Image.jpg"
END SUB
The following error is displayed
Unknown statement
FUNCTION ExportObjectToJpg( ObjID, fName)
ActiveDocument.GetSheetObject(ObjID).ExportBitmapToFile fName
END FUNCTION
SUB CallExample
ExportObjectToJpg "CH01", "C:\CH01Image.jpg"
END SUB
I obtained the script from here:
QlikView Macros – Useful collection | Lucian Cotea
and also tried
FUNCTION RunExe(cmd)
CreateObject("WScript.Shell").Exec(cmd)
END FUNCTION
SUB CallExample
RunExe("c:\Program Files\Internet Explorer\iexplore.exe")
END SUB
which again fails.
I'm at a loss, any help greatly appreciated.
That code from Lucian works fine for me. Do you actually have a chart object with Id CH01?
I Do, but as mentioned even the launch IE script won't work either.
i Must be missing something obvious.
Hi, it works fine for me
do you have this root path?
do you have permission to write in c:?
do you have select in combo box in macro ALLOW SYSTEM ACCES?
something in your configuration is the problem
good luck!
Fernando
Where do I find
"select in combo box in macro ALLOW SYSTEM ACCESS?"
thanks
Hi
just to make sure. You wrote Ctrl-E, that opens the script editor.
This code should go in macro editor Ctrl-M.
Hi Jerry, you found the problem.
The macro now works, as you pointed out I had it in the script editor as I pointed in in my first post.
How do I call the macro to run when refreshing?
thanks
You can trigger your macro on PostReload.
But you have to do a batch reload using qv.exe /r app.qvw, since triggers will not trigger if you run a standard Publisher task.
Ok, created a DOS batch file which runs and updates the data, but does not create the jpg files.
Do I need a trigger in the file?
Hi, try this document and tell me how was