Page 1 of 3 123 LastLast
Results 1 to 15 of 38
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clear the clipboard

    Ok, I'm lost. This has GOT to be easy. But I can't find it. How do I clear the clipboard?

    I've setup some toolbar controls, and because some of them (Word Defaults to boot!) will not create properly with the .add method and the ID and Type properties (this is bizarre, but true), I have to hide copies in another toolbar and copy them to the Standard and Formatting toolbars. Doing so leaves the clipboard "dirty" and the user sees the Paste button "hot". I'd rather show the paste button grey (meaning nothing to paste). Clearing the clipboard is the goal. How?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    Kevin,

    This link might help <A target="_blank" HREF=http://www.cpearson.com/excel/clipboar.htm>Pearson Software Consulting</A> hopefully

    Andrew

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    Thanks, Andrew. That code does indeed do the trick. The paste button face still shows "hot". So I'll guess if I want to press the issue I'll have to msobuttonup or down or something. (maybe paste is never greyed out?) Can't believe I've never noticed this before.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    kelliel
    Guest

    Re: Clear the clipboard

    My guess, and it is just a guess, is that since you are still "putting" something on the clipboard (with the command PutInClipboard), that the paste stays enabled.

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    I thought about that too so I tried this:

    The .clear method. Try pressing the Paste button after using that method. Out of memory error. That's interesting. And the button is not grey.

    Obviously, that's not the purpose of the .clear method.

    Logically speaking, I guess you are right: once there's something in the clipboard, there's always something in it even it it's the null string.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #6
    kelliel
    Guest

    Re: Clear the clipboard

    Question?

    Is "" a null string? Or is it an empty string? Are they different?

    (Ya, I know, I implied one question....) <img src=/S/shocked.gif border=0 alt=shocked width=15 height=15>

  7. #7
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    What is this, a test?

    As far as my understanding goes, a zero-length string is a null string is an empty string. I realize that that definition may be contradict the definition of NULL which means "no valid data" -- empty string is certainly valid. But in the case of strings, I see "NULL" morphed to "null" and semantically the same as zero-length and empty. What sayest thou?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  8. #8
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    I tried substituting "" with vbNull and vbEmpty, which returned 1 and zero respectively (as contents of the clipboard), so assigning those is not an option.

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    I stand corrected.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  10. #10
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    Kevin,

    far be it for me to correct your goodself. vbNull and vbEmpty return values that represent the type of data VB regards them as (or something like that). Trying to use just Null provokes an invalid use of Null !. Maybe Null is so Null that to access it renders it NOT Null.

    For the record this is hoe VB help describes Null and Empty :-
    <hr>The Null value indicates that the Variant contains no valid data. Null is not the same as Empty, which indicates that a variable has not yet been initialized. It is also not the same as a zero-length string (""), which is sometimes referred to as a null string.
    <hr>

    Not much help I know

    Andrew

  11. #11
    kelliel
    Guest

    Re: Clear the clipboard

    Nope. Not a test.

    Whereas what you say is true that in one respect "" and null are the same, I know that sometimes is not the case. My original thought was that there must be a state in which the clipboard can exist where the Paste menu choice is disabled. Call that state "" or Null or ???

    Whereas the code does "empty" the clipboard, as you noted, the Paste menu item is still enabled. However, after rebooting and then reopening Word, I noticed that the Paste menu item was disabled. Therefore, there has to be a state in which the clipboard is really empty.

  12. #12
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    That is interesting. I my case, the button is always enabled. Not sure why. I'm not sure it's worth pursuing. At least now if a user clicks the button they won't paste into their document the last faceid from the last control copied [img]/forums/images/smilies/smile.gif[/img]
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  13. #13
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear the clipboard

    Ah hah! See that's where I got the lingo. "...sometimes referred to as a null string"

    Technically inaccurate, but out on the street we all know what we mean.

    It's sort of like using + to concatenate strings. It started with Turbo Pascal where that was cooler than using Concat(). At least I thought so. And I got used to seeing it in the code. When I started with VBA, I was happy to see some familiar constructs. But in VB, even though it works, it's not the best way. Use & instead, right?

    Anyway, always a pleasure to brain-pick with you all! Keeps the synapses from clogging up.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  14. #14
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Clear the clipboard

    vbNullString is a different kind of animal from vbNull and vbEmpty - unrelated in spite of the similar names.

    My understanding of this is that vbNullString is a built-in VBA string constant. Some of the articles on optimizing code suggest using vbNullString in place of strString = "" - from that, the assumption is that VBA has to evaluate "" to vbNullString, so you can save it that processing step by using vbNullString.

  15. #15
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear the clipboard

    If you want to confuse the issue further, I had a college VB instructor who insisted on our referring to an empty string as 'null' (i.e., txtSomething = null) in pseudocode. It drove me nuts because a null is entirely different from an empty string.

    As far as the concatenation operators go, either will work but the behave differently. If you use & to concatenate a string to a null, you get a string. If you use +, you get a null.
    Charlotte

Page 1 of 3 123 LastLast

Posting Permissions

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