Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jul 2002
    Location
    Edison, New Jersey, USA
    Posts
    215
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Check the clipboard's Contents? (WD97)

    How can I confirm that the clipboard actually has contents? I have a macro that pastes the contents of the clipboard, but if the clipboard is empty, it errors out on Selection.Paste.

    SO, I guess I am wanting to "disable" the paste option if there are no contents on the clipboard.

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Eugene, Oregon, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check the clipboard's Contents? (WD97)

    Can you use an "On Error Resume Next" statement to skip the paste if there's nothing in the clipboard?

    [There is a "CanPaste" method to test whether or not you can paste into an object on a form, but I don't know of a related method for the selection object, but maybe somebody else on the Board will.]

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Check the clipboard's Contents? (WD97)

    To check that the clipboard has text on it you can use something like...

    Dim objTest As New DataObject
    objTest.GetFromClipboard
    If objTest.GetFormat(1) = True Then
    <font color=448800>'Put your code here</font color=448800>
    End If

    You may need to use Tools > References to add a reference to the Microsoft Forms 2.0 Object Library if the DataObject doesn't seem to exist on your system.

    StuartR

Posting Permissions

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