Excel VBA Clipboard problem when using Active-X control RRS feed

  • Question

  • I have a problem with using an Active-X control on a worksheet with VBA code that places text on the Windows Clipboard.

    This code works as long as I do not have any Active-X controls in the worksheet...

            Dim sysClipboard As New DataObject
            sysClipboard.SetText Range("wsClipboardContents").value

    As soon as I insert any Active-X in the spreadsheet, the value that is stored in the clipboard comes out as two question marks (presumably because it is non-printable character.

    Also if I run this spreadsheet (without Active-X controls) everything works perfectly. If I keep the spreadsheet open and open another unrelated spreadsheet that uses Active-X controls, the question mark problem occurs on the first spreadsheet.  Close the second and it all works again.

    Can anyone help me to get the VBA code to work when an Active-X control is present?

    Many thanks for any advice or guidance.
    • Edited by L Lazarus Sunday, February 2, 2014 3:28 PM
    Sunday, February 2, 2014 3:26 PM

All replies

  • What's version of Excel are you using. Nothing happens when I run the code in Excel 2013 no matter whethe there is a active-x control in the worksheet.
    Monday, February 3, 2014 3:56 AM
  • I am using Excel 2013.

    You need to assign the name wsClipboardContents to a cell and then place a value in that cell for the code to actually put anything in the clipboard.

    Monday, February 3, 2014 7:54 AM