Clearing Clipboard in Excel 2013 VBA

melson titular

New Member
Joined
Oct 3, 2013
Messages
43
Hello guys.,

i have found this code and tried it out.,
upon checking., it seems it is applicable only for 2004 and below excel versions.
is there other way to clear the clipboard in excel 2013?

Option Explicit
Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function EmptyClipboard Lib "user32" () As Long
Public Declare Function CloseClipboard Lib "user32" () As Long
Public Function ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
End Function
Sub Test()
Call ClearClipboard
End Sub

regards, melson
 
Foe a quick moment, let us take a step back. When you say you are copying from a series of workbooks, and pasting to your 'original working file', what exactly are you pasting? Or that is, more specifically, what do you actually need to paste?

I ask as unless you need to be copying colors and various other formatting - if you are just taking the values (regardless of string or numeric) then this can be done without the clipboard at all.

Mark
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Maybe...
Code:
Application.displayalerts =False
before closing the wb that U are getting info from? HTH. Dave
 
Upvote 0
Foe a quick moment, let us take a step back. When you say you are copying from a series of workbooks, and pasting to your 'original working file', what exactly are you pasting? Or that is, more specifically, what do you actually need to paste?

I ask as unless you need to be copying colors and various other formatting - if you are just taking the values (regardless of string or numeric) then this can be done without the clipboard at all.

Mark

thanks mark!, i manage to fix process A, i just put the cell value in a string then paste it to a specific cell location with out the help of clearing the clipboard. the program works smoothly now. thanks for providing the idea.

for clearing the clipboard using vba., i guess i have to set aside this and move on to another challenge. =)

regards, melson
 
Upvote 0
thanks mark!, i manage to fix process A, i just put the cell value in a string then paste it to a specific cell location with out the help of clearing the clipboard. the program works smoothly now. thanks for providing the idea....

If you are still actually pasting something, then you are still using the clipboard. What I was trying to say is that if we just need the values, then we can easily code:

This particular cell in this workbook = a specific cell in a specific other workbook.

Does that make sense?

...for clearing the clipboard using vba., i guess i have to set aside this and move on to another challenge. =)

I just have never learned/do not know how to post a screenshot here. Hence, I cannot give you a good visual. I still suspect that you are using a taskpane and not the Windows clipboard. AFAIK, Windows Clipboard only "holds" one "thing" at a time. Conversely, Excel (Word, and possibly etc.) holds something like 24 "things" and AFAIK, is not easily clearable. (<---I have no idea if that is an actual word, but let's cheat)

Mark
 
Upvote 0
"If you are still actually pasting something, then you are still using the clipboard. What I was trying to say is that if we just need the values, then we can easily code:

This particular cell in this workbook = a specific cell in a specific other workbook.

Does that make sense? "

--- i think it is more of displaying the string in a cell rather than pasting because i did not see the clipboard populate with data after i run the code.
 
Upvote 0

Forum statistics

Threads
1,215,831
Messages
6,127,138
Members
449,361
Latest member
VBquery757

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top