Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm just learning how to create SUB and FUNCTION in Qlikview. I have a function called CreateExcel() which accepts an ObjectID.
If I do a Test within the Edit Module, it creates the Excel with the object id I passed in. However if I place this call in the Load Script like
call CreateExcel("TB01");
I get this error:
Script line error: call CreateExcel("TB01")
If I used this syntax in load script
LET vRetVal = CreateExcel("TB01");
I didn't get the error but no Excel generated either.
What's the right syntax to call this in load script?
Thanks
I don't think you can access the chart objects from within the script execution.
Hello,
the option I recommend,
add a trigger, after charging, running the macro,
example:
OK, thank you. This makes sense now that I'm thinking about it as the document objects haven't loaded yet.
I think I was just anxious to test out the macro. I am assuming you can create a button to invoke the function? How do you pass in the parameter?
Hi jer_2011
Yes, your suggestion worked !!. Now how do I pass in the Object ID to the function?
Thanks!
I don't think so either. For example, if you run this script under QVB control, there are no UI objects at all. They only get created when QVS loads the document in memory and tries to visualise whatever you created on your sheets.
Hello
example Object ID to Excel
sub Macro1()
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open("c:\Excel.xls") ' file name excel
objExcel.Visible = True
objExcel.Sheets("sheet1").activate
ActiveDocument.GetSheetObject("TX03"). CopyBitmapToClipboard ' Objet ID
objExcel.Sheets("sheet1").cells(2,2).select
objExcel.Sheets("sheet1").paste
ActiveDocument.GetSheetObject("CH05"). CopyBitmapToClipboard ' Objet ID
objExcel.Sheets("sheet1").cells(2,4).select
objExcel.Sheets("sheet1").paste
end sub
Yes, I know how to code the function to accept a parameter. But how do I call it using the trigger example you provided in above? When I entered in the Macro Name like CreateExcel("TB01") to include the object id, it did not work. Maybe my syntax isn't correct? Thank you again.
Hi
to work with the example that happens, just add the name of the macro
But you're hard coding the object id - like TX03, CH05 in your example.
I want to find out how to pass in dynamically. Is this possible?