Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get Clipboard Text as Variable in Script

Hi QlikView Experts!

Newbie here back with question:

I have this script to copy and read the clipboard text to have further process.

in VBScript I wrote:

Sub ProcessClipboard

ActiveDocument.GetSheetObject("TX01").CopyTextToClipboard

Dim x

x = GET_CLIPBOARD_VALUE

End Sub

How can I set X with clipboard value in QV?

Please help. Thank you.

A

1 Solution

Accepted Solutions
Not applicable
Author

Hi Adrian:

I'm not sure how to read the contents from Clipboard using VBS + Qlikview.  However, in case of straight table, you can read the data by rows and columns with the following script (Source:  Qlikview API Guide)

Sub ReadStraightTable

Set Table = ActiveDocument.GetSheetObject( "CH01" )
For RowIter = 0 to table.GetRowCount-1
   For ColIter = 0 to table.GetColumnCount-1
        set cell = table.GetCell(RowIter,ColIter)
        Msgbox(cell.Text)
    Next
Next

End Sub

There should be a better/easy way, may be I'm not familiar at this moment

Thanks,

Narasimha K

View solution in original post

5 Replies
Not applicable
Author

Use GetText instead of CopyTexttoClipboard, following is the snippet:

Sub ProcessClipboard

Dim x

x = ActiveDocument.GetSheetObject("TX01").GetText
msgbox x

End Sub

Regards,

Narasimha K

Not applicable
Author

Hi Narashima!

Thanks that is really helpful.

But what if the source object is a STRAIGHT TABLE with object ID "CH04"

I got this:

Object doesn't support this property or method: 'ActiveDocument.GetSheetObject("CH04").GetText'

Please help.

Thank you.

Not applicable
Author

Hi Adrian:

I'm not sure how to read the contents from Clipboard using VBS + Qlikview.  However, in case of straight table, you can read the data by rows and columns with the following script (Source:  Qlikview API Guide)

Sub ReadStraightTable

Set Table = ActiveDocument.GetSheetObject( "CH01" )
For RowIter = 0 to table.GetRowCount-1
   For ColIter = 0 to table.GetColumnCount-1
        set cell = table.GetCell(RowIter,ColIter)
        Msgbox(cell.Text)
    Next
Next

End Sub

There should be a better/easy way, may be I'm not familiar at this moment

Thanks,

Narasimha K

Not applicable
Author

Can't thank you enough Narasimha.

Thank you!

Not applicable
Author

Hi,

How to get if the sourceobject  is straight table with object ID "CH28". Then Msgbox() wont work right.

Sub ReadStraightTable

Set Table = ActiveDocument.GetSheetObject( "CH28" )
For RowIter = 0 to table.GetRowCount-1
   For ColIter = 0 to table.GetColumnCount-1
        set cell = table.GetCell(RowIter,ColIter)
        Msgbox(cell.Text)
    Next
Next

End Sub

How to get if source object is line chart.

Thanks,

Sahithya