Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Copy object to text only works once ?

Hi everybody,

I am trying to launch a macro (using a button with an action) which needs to copy text from a charts to the clipboard.

I am using this line (Edit Module):

ActiveDocument.GetSheetObject("CH01").CopyTextToClipboard

And it works...... .. . . . .. once ???

If I use the button again it doesn't do anything anymore. After I close the qlikview file and open it again then it works again, also only once.

Does anybody know why this is and what I can do to fix it?

Thanks!

1 Solution

Accepted Solutions
Not applicable
Author

You don't need system access to execute that macro.

It might be as simple as that you haven't specifed the macro sub name in the button properties.
If your macro code reads:
sub CopyText
ActiveDocument.GetSheetObject("CH01").CopyTextToClipboard
end sub

the button properties > Actions > Macro Name should say CopyText

Kind regards,
Staffan

Support Technician, QlikTech

View solution in original post

4 Replies
manishkumar75
Partner - Creator II
Partner - Creator II

Hi, What are you doing with the content after putting it into Clipborad ? IF you required to Paste it in Excel Sheet then you can try the below :-

Sub Export()
Dim kost
Set XLApp = CreateObject("Excel.Application")
XLApp.Visible = TRUE
Set XLDoc = XLApp.Workbooks.Add
kost = ""
kost = "Sheet1"
ActiveDocument.GetSheetObject("CH01").CopyTextToClipboard 'Copy the charts value
XLDoc.Sheets(kost).Range("A" & 1).Select
XLDoc.Sheets(kost).Paste

ActiveDocument.GetSheetObject("CH02").CopyTextToClipboard 'Copy the charts value
XLDoc.Sheets(kost).Range("H" & 1).Select
XLDoc.Sheets(kost).Paste


End Sub

Anonymous
Not applicable
Author

Thanks Manish,

That is some usefull code! Smile


But I just found out that it isn't the code that is causing the problem. it looks like it is the button.

When I go to the properties of the button >> Actions >> Edit Module (@Run Macro) and I run [ Test ] then it does copy the charts.

But when I save this and use the actuel button in the Qlikview document it doesn't.

I already changed the security settings to:

Requested Module Security ---- > System Access

Current Local Security --- > Allow System Access

But no difference.....


Not applicable
Author

You don't need system access to execute that macro.

It might be as simple as that you haven't specifed the macro sub name in the button properties.
If your macro code reads:
sub CopyText
ActiveDocument.GetSheetObject("CH01").CopyTextToClipboard
end sub

the button properties > Actions > Macro Name should say CopyText

Kind regards,
Staffan

Support Technician, QlikTech

Anonymous
Not applicable
Author

Yes that it! Thanks! Yes