Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
is it possible to copy a container an all objects in as a picture?
There is an option, but does'nt seems to work:
Thanks
Laurent
I never tried it but may be with a macro?
There are a lot of examples to crear an Excel Application object and copy-paste objects, the next two lines are to get the object container, you need to use the ID of your container "CTXX" and copy the object as bitmap but I´m not sure that this works with a container... you could use with the charts inside the container.
Set ContainerObj= ActiveDocument.GetSheetObject("CT01") '
ContainerObj.CopyBitmapToClipboard true
hope this helps
Thanks for your suggestion.
I had already try it but without success.
To copy chart inside container via macro, need to activate and restore the container before copying chart.
Something like this:
set ContainerObj = ActiveDocument.GetSheetObject("CTXX")
ContainerObj.GetSheet().Activate()
ContainerObj.Restore
set objSource = ActiveDocument.GetSheetObject("CHXXX")
objSource.Restore
ActiveDocument.GetApplication.WaitForIdle
objSource.CopyBitmapToClipboard()
Regards
I didn´t know that, do you know what is the behaviour of functions Activate, Restore and WaitForIdle?
I´m glad to be helpfull, I hope you get the full solution
Regards
"ContainerObj.GetSheet().Activate() " is to activate the sheet where the Object is in. Essential before select the object itself.
"Restore" is like maximise and minimise the object but on the sise defined in properties, tab>legend
"WaitForIdle" is just to wait the refresh or calculating of the table or chart is done before copying it.
To export into excel file, my base was the very good work of Stefan Walther:
Regards
Amazing!!
Hi!
I have the same need and I had the same disappointing discovery of one of the few Qlikview bugs :
copybitmaptoClipboard does not work on containers !!!
I work out a turn around this way :
a: create a button
b: assign external / macro
c: use the following code
sub Container_copy
Dim obj
Dim fso
set obj = ActiveDocument.GetSheetObject("CT03")
Set objIE = CreateObject("InternetExplorer.Application")
Set WShell = CreateObject("WScript.Shell")
'WScript.Sleep 250
Set fso = CreateObject("Scripting.FileSystemObject")
set obj = nothing
set fso = nothing
end sub
This copies container image to a file and then opens the file in MSpaint / select it / copies it to clipboard / close MSpaint / erases the file.
Hope this helps.
You can change the end to paste the clipbloard in MS Powerpoint, Word or excel ...