473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Trap for 'clipboard is empty' 'error'

In a button I have this code:

Testfield.SetFocus
DoCmd.RunCommand acCmdPaste

When the clipboard is empty this gives an error saying that this action is
not available at the moment. I'd like to trap for this error, prevent the
message from showing, and stop the whole routine that comes after this code.
What would be the best way to do this?
thanks,
john
Sep 23 '06 #1
2 2698
I do this in two steps:

First, find out what error is thrown. Put 'on error resume next' before
the offending line, and

if err>0 then msgbox err.number & ":" & err.description

afterwards. Now, force the error to occur, in this case, executing with
an empty clipboard. Aha: 2501 action is not available (giving the number
from my head, it may be another one).

Now you can refine the If statement:

if err=2501 then
exit sub
else
' do whatever you wish for a less expected error.
' Signal it and indicate what the user could do
end if

john schreef:
In a button I have this code:

Testfield.SetFocus
DoCmd.RunCommand acCmdPaste

When the clipboard is empty this gives an error saying that this action is
not available at the moment. I'd like to trap for this error, prevent the
message from showing, and stop the whole routine that comes after this code.
What would be the best way to do this?
thanks,
john

--
Bas Cost Budde
Holland
Sep 23 '06 #2
Thanks! btw it was 2046...
john

"Bas Cost Budde" <b.*********@dev.null.comschreef in bericht
news:ef**********@localhost.localdomain...
>I do this in two steps:

First, find out what error is thrown. Put 'on error resume next' before
the offending line, and

if err>0 then msgbox err.number & ":" & err.description

afterwards. Now, force the error to occur, in this case, executing with an
empty clipboard. Aha: 2501 action is not available (giving the number from
my head, it may be another one).

Now you can refine the If statement:

if err=2501 then
exit sub
else
' do whatever you wish for a less expected error.
' Signal it and indicate what the user could do
end if

john schreef:
>In a button I have this code:

Testfield.SetFocus
DoCmd.RunCommand acCmdPaste

When the clipboard is empty this gives an error saying that this action
is not available at the moment. I'd like to trap for this error, prevent
the message from showing, and stop the whole routine that comes after
this code.
What would be the best way to do this?
thanks,
john

--
Bas Cost Budde
Holland

Sep 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gey-Hong Gweon | last post by:
Is there a way to copy a PIL image to windows clipboard (as a dib image or a bitmap, I suppose)? What I would like to accomplish is to do a fast copy and paste of images from my python...
0
by: Ata | last post by:
Hello, I am trying to copy the contents of the output of SQL Reporting Services to a PowerPoint slide. For this, I am using SQL Reporting Services to obtain an IMAGE stream, which I paste to the...
2
by: emr | last post by:
Hi, i want to empty clipboard but i don't want to use this one Clipboard.SetDataObject("",true); It must be really empty when i do this...
4
by: Joshua Campbell | last post by:
I am working on an application that needs to parse out data that has been copied into the clipboard. My first questions are how can I detect if the clipboard is empty, and how can I empty the...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
3
by: Lee | last post by:
Hi, How do i check to see if the clipboard is empty? thanks in advance lee
8
by: serge calderara | last post by:
Dear all, I have an treeview control with different node object, I would like to implement the Copy/Paste function of an object . For that I am using the folowing function to copy teh object to...
8
by: active | last post by:
Guess I'm looking for someone who likes to work difficult puzzles. I can't seem to ever retrieve a palette handle from the clipboard. Below is a simple test program that demonstrates the...
0
by: Academia | last post by:
I ran Dim Strs As String() = Nothing ....fill Strs with file paths DataO.SetData(DataFormats.FileDrop, True, Strs) Clipboard.SetDataObject(DataO) When I tried to paste into Wordpad I got...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.