Hi All,
Is there a way to clear the clipboard contents using VBA? I don't want to turn it off, I only want to clear what is currently located there.
Thanks,
Mark
Clear Clipboard Contents
-
- 3StarLounger
- Posts: 253
- Joined: 19 Apr 2010, 09:01
- Location: Indiana, USA
Clear Clipboard Contents
Thanks,
Mark
Mark
-
- Administrator
- Posts: 78391
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Clear Clipboard Contents
Select Tools | References...
Click Browse...
Type FM20.DLL in the Filename box.
Click OK.
You can now use code like this:
Click Browse...
Type FM20.DLL in the Filename box.
Click OK.
You can now use code like this:
Code: Select all
Sub ClearClipboard()
Dim objData As New MSForms.DataObject
objData.SetText ""
objData.PutInClipboard
Set objData = Nothing
End Sub
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 253
- Joined: 19 Apr 2010, 09:01
- Location: Indiana, USA
Re: Clear Clipboard Contents
Hi Hans,
So cool! Do you have any handy code that will grab a screen capture of the active window? The code I mentioned earlier is not as reliable as I would like.
Thanks,
Mark
So cool! Do you have any handy code that will grab a screen capture of the active window? The code I mentioned earlier is not as reliable as I would like.
Thanks,
Mark
Thanks,
Mark
Mark
-
- Administrator
- Posts: 78391
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Clear Clipboard Contents
I'm afraid not - the code that you posted is the "standard" way to perform a screen capture in VBA.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 253
- Joined: 19 Apr 2010, 09:01
- Location: Indiana, USA
Re: Clear Clipboard Contents
Sometimes when I execute the code, I get a RTE 7, out of memory. I am not sure what this is really telling me.
Thanks,
Mark
Mark
-
- 3StarLounger
- Posts: 253
- Joined: 19 Apr 2010, 09:01
- Location: Indiana, USA
Re: Clear Clipboard Contents
Hi Hans,
Looking at this standard code, is there an option to save as JPEG instead of BMP???
Thanks,
Mark
Looking at this standard code, is there an option to save as JPEG instead of BMP???
Thanks,
Mark
Thanks,
Mark
Mark
-
- 3StarLounger
- Posts: 253
- Joined: 19 Apr 2010, 09:01
- Location: Indiana, USA
Re: Clear Clipboard Contents
HI Hans,
Looking at my code, I see why I can't grab the active msgbox window. I click OK before copying to the clipboard, hence the msgbox is closed. I will instead capture the form name, module, etc and store that in a table.
Mark
Looking at my code, I see why I can't grab the active msgbox window. I click OK before copying to the clipboard, hence the msgbox is closed. I will instead capture the form name, module, etc and store that in a table.
Mark
Thanks,
Mark
Mark
-
- 4StarLounger
- Posts: 495
- Joined: 13 Sep 2013, 07:56
Re: Clear Clipboard Contents
You may care to look at this http://www.utteraccess.com/forum/lofive ... 48262.htmlsantosm wrote:Hi Hans,
Looking at this standard code, is there an option to save as JPEG instead of BMP???
Thanks,
Mark
Regards, Ben
"Science is the belief in the ignorance of the experts."
- Richard Feynman
"Science is the belief in the ignorance of the experts."
- Richard Feynman
-
- 3StarLounger
- Posts: 253
- Joined: 19 Apr 2010, 09:01
- Location: Indiana, USA
Re: Clear Clipboard Contents
Thanks Ben,
That code is exactly what I am using and it seems to work OK sometimes, but I am still getting a lot of RTE 7 (out of memory) when the clipboard is first empty and it gets to the line where it wants to save the file. If I run in break mode, it always works.
Thanks,
Mark
That code is exactly what I am using and it seems to work OK sometimes, but I am still getting a lot of RTE 7 (out of memory) when the clipboard is first empty and it gets to the line where it wants to save the file. If I run in break mode, it always works.
Thanks,
Mark
Thanks,
Mark
Mark
-
- 4StarLounger
- Posts: 495
- Joined: 13 Sep 2013, 07:56
Re: Clear Clipboard Contents
You might try loading the clipboard with some stuff when you first start and then see if it still fails when invoked.santosm wrote:Thanks Ben,
That code is exactly what I am using and it seems to work OK sometimes, but I am still getting a lot of RTE 7 (out of memory) when the clipboard is first empty and it gets to the line where it wants to save the file. If I run in break mode, it always works.
Thanks,
Mark
Regards, Ben
"Science is the belief in the ignorance of the experts."
- Richard Feynman
"Science is the belief in the ignorance of the experts."
- Richard Feynman