How to Suppress the Beep on Copy nothing

I have a subroutine that will copy the entire contents of a textbox to a variable (simulate Cmd-A then Copy). The subroutine tests the ActionResult of the Copy and if it's not OK then the textbox was empty and the return variable is "". This all works fine BUT I can't stop the Beep when Copy tries to copy nothing. Is there anyway to suppress the beep just for this action?

Copy Contents of TextBox even if blank.kmmacros (4.9 KB)

Just check that a Copy menu item is enabled before you try to copy, and you won't try to copy nothing. (Hope that makes sense; that's a lot of copies of 'copy' in one sentence :)).

If you need to set a variable to empty if the text box is empty, just do that in the Else of the If.

-rob.

1 Like

Copy that!
Brilliant, it works perfectly
thanks much

Dave