Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Dubai, UAE, United Arab Emirates
    Thanked 0 Times in 0 Posts

    Copy to Clipboard as Text (Excel XP)

    G'day All

    I have a spreadsheet that is used to generate a text string based on a set of variables. The user enters/selects various parameters, then looks at the generated name, then enters that name into another application. I would like to use copy and paste, but when I use paste in the destination application (Ctrl-V) I get an error. I discovered that if I copy in excel, then paste into notepad, then copy that text, then paste into the destination application, it works. Thus I think the problem is that excel is copying the cell as a cell, and the destination application is not able to convert this to text.

    So I would like a function in excel that I can click on or use a keyboard combination that will copy the string text equivalent onto the windows clipboard. I took the following code from a previous post, but it generates an error:

    Sub CopyText()
    Dim objTemp As New DataObject
    Dim strText As String
    strText = ActiveCell.Text
    objTemp.SetText strText
    Set objTemp = Nothing
    End Sub

    The error is "User Defined Type Not Defined" and highlights "objTemp As New DataObject"

    I've played but can't remember how to define objects in excel. Perhaps I'm, missing a library reference.

    Any assistance would be most appreciated.

    Thanks, Regards Ken.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Copy to Clipboard as Text (Excel XP)

    Also asked - and answered - in <post#=380841>post 380841</post#>.

    To avoid duplication and confusion, I am locking this thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts