Results 1 to 4 of 4

Thread: Reading Clipboard in VBA Word

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455

    Reading Clipboard in VBA Word

    Dear VB users,

    Is there someone who can give me code to send the information from the clipboard to a variable.

    Dim QQ as String
    Selection.Copy
    QQ = Selection.Paste 'does not work!!!!!!!!!!!

    How can I get the clipboard information to variable QQ

    Nice regards,

    Michelle.

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    Code:
          Dim MyData As DataObject
          Set MyData = New DataObject
          Dim sClipText As String
          MyData.GetFromClipboard
          sClipText = MyData.GetText(1)
          MsgBox sClipText
    VBBrowser v2.2.4
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    Actually - CHange it to catch errors (unless you are sure you will always have text in it)


    Code:
          Dim MyData As DataObject
          Set MyData = New DataObject
          Dim sClipText As String
          On Error GoTo NotText
          MyData.GetFromClipboard
          sClipText = MyData.GetText(1)
          MsgBox sClipText
       NotText:
          If Err <> 0 Then
             MsgBox "Data on clipboard is not text."
          End If
       
    VBBrowser v2.2.4
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455
    Hello geoff_xrx,

    Thanks for your helpfull information.

    Michelle.

Posting Permissions

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



Click Here to Expand Forum to Full Width