Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Why could this script fail:
XLApp.Sheets(1).Range("A27").Select
ActiveDocument.GetSheetObject("eur").CopyBitmapToClipboard TRUE
XLApp.Sheets(1).PasteSpecial Format = Bitmap
The error that is given:
Wrong number of arguments or invalid property assignment: 'ActiveDocument.GetSheetObject(...).CopyBitmapToClipboard'
When I change from CopyBitmapToClipboard to CopyTableToClipboard macros executes just fine, only I do get the table not a chart.
Could anybody please help me out?
Thank you!
This worked. The main-issue was the missing sheet-reference within excel but there was also a not assigned variable and no store of the excel.
- Marcus
Why do you want to use pastespecial by an image instead of just paste?
- Marcus
I do not have any comments on that. I did change it to Paste
Unfortunately I guess that's not the case because while running the code it highlights this line:
ActiveDocument.GetSheetObject("eur").CopyBitmapToClipboard TRUE
AFAIK copybitmaptoclipboard hadn't a further parameter TRUE/FALSE because it's only a switch by table-charts and copytabletoclipboard. Beside them you need to ensure that "eur" is really a valid object-id and that this object is currently displayed within qlik - if it's hidden in a container or by a condition or minimized it won't work.
- Marcus
The chart is not hidden or minimized, the object ID is valid:
I am also using copytabletoclipboard as well as copybitmaptoclipboard thats why I am using the parameter TRUE/FALSE. By removing it nothing changes the script stops on the same line but without showing any error.
Although the script seems to work when leaving everything the same except changing CopyBitmapToClipboard to CopyTableToClipboard.
If a qlik macro failed the cursor-position within the macro-editor isn't mandatory by the error and might therefore leading in wrong direction. Put a few msgbox in your code to find the real place where the error happens. If this didn't help please provide an example.
- Marcus
ActiveDocument.Sheets(0).Activate | ||
XLApp.Sheets(1).Select | ||
MsgBox "This is fun" | ||
ActiveDocument.GetSheetObject("kg").CopyBitmapToClipboard | ||
'MsgBox "This is fun2" | ||
XLApp.Sheets(1).Range("A27").Select | ||
XLApp.Sheets(1).PasteSpecial Format = Bitmap |
With the MsgBox "This is fun" everything works fine. But when I comment it everything stops again. How to understand this? What am I missing?
That's strange - maybe something is still processing and not yet finished if you call your routine respectively between the various statements within the routine. To resolve this you could use the following statements:
ActiveDocument.GetApplication.WaitForIdle
rem ** let QV sleep for 1 seconds **
ActiveDocument.GetApplication.Sleep 1000
Beside them I think I wouldn't rather use a selection-statement to the sheet:
XLApp.Sheets(1).Select
else just activating the sheet, select a certain range and than paste your content maybe in this way:
ActiveDocument.Sheets(0).Activate
ActiveDocument.GetSheetObject("kg").CopyBitmapToClipboard
XLApp.Sheets(1).Activate
XLApp.Sheets(1).Range("A27").Select
XLApp.Sheets(1).Paste
- Marcus
I am stopped by this issue.
Could you please check the example attached?