0

I'm attempting to get the value of a Textbox in my SSRS report, and copy that value to the clipboard so the user can paste it elsewhere. I am doing this in the form of a button the user can click.

However, I seem to be getting an error and I am unsure why this is the case.

Below is the expression I am using for the button:

=Code.CopyToClipboard(ReportItems!TextToCopy.Value)

And here is the custom code I am using for the report:

Public Sub CopyToClipboard(ByVal textBoxValue As String)
        My.Computer.Clipboard.Clear()
        My.Computer.Clipboard.SetText(textBoxValue)
    End Sub

When previewing the report I get the following error:

The Value expression for the textrun 'CopyText.Paragraphs[0].TextRuns[0]' contains an error: [BC30491] Expression does not produce a value.

Any ideas as to why I may be getting this error?

Lenfred
  • 1
  • 1
  • "When copying and pasting dataset-linked objects in a Reporting Services report using SQL Server Data Tools, expressions will paste as fully-qualified expressions. If we use CStr (or CDbl or a number of other conversion functions) in the expression, the CStr function becomes – Snowlockk Mar 14 '17 at 12:31
  • "Microsoft.ReportingServices.RdlObjectModel.ExpressionParser.VBFunctions.CStr", which will not compile. The error is “[BC30456] 'RdlObjectModel' is not a member of 'Reporting Services'”." https://social.msdn.microsoft.com/Forums/sqlserver/en-US/51f90f6a-459d-41bd-a11c-62e8cc572543/the-value-expression-for-the-textrun-textbox245paragraphs0textruns0-contains-an-error?forum=sqlreportingservices – Snowlockk Mar 14 '17 at 12:31
  • @Snowlockk Ok, but I'm not sure the error presented in that link is related to the error I'm receiving? Unless you would like to elaborate further? – Lenfred Mar 14 '17 at 12:48

1 Answers1

0

I was able to copy to Clipboard using this expression in a Textbox under Textbox Properties -> Action -> Go To URL:

="javascript:eval(""navigator.clipboard.writeText('Text to be copied 1 2 3');"");"

KR, Alex

Alex
  • 1