PC Review


Reply
Thread Tools Rate Thread

CLEARING THE CLIPBOARD !!!

 
 
jay dean
Guest
Posts: n/a
 
      4th Jun 2009

Hi - I am using Chip Pearson's code below to clear the clipboard. I have
assigned it to a form's command control and when I compile, I get "Only
comments may appear after End Sub, End Function, or End property."

What am I doing wrong? Below is how I am using the code:

Private Sub CommandButton2_Click()

Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long)
As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function CloseClipboard Lib "user32" () As Long

''''Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
''''End Sub

End Sub




*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      4th Jun 2009
Those Declare statements cannot be placed inside of a Sub (or Function)
procedure... they must go in the <General><Declaration> section of the code
window (look at the two drop down boxes at the top of the code window) and,
if there were any constants (Const statements) associated with the Declare
statements, they too should go in the <General><Declaration> section of the
code window as well.

--
Rick (MVP - Excel)


"jay dean" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Hi - I am using Chip Pearson's code below to clear the clipboard. I have
> assigned it to a form's command control and when I compile, I get "Only
> comments may appear after End Sub, End Function, or End property."
>
> What am I doing wrong? Below is how I am using the code:
>
> Private Sub CommandButton2_Click()
>
> Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long)
> As Long
> Private Declare Function EmptyClipboard Lib "user32" () As Long
> Private Declare Function CloseClipboard Lib "user32" () As Long
>
> ''''Sub ClearClipboard()
> OpenClipboard (0&)
> EmptyClipboard
> CloseClipboard
> ''''End Sub
>
> End Sub
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***


 
Reply With Quote
 
r
Guest
Posts: n/a
 
      4th Jun 2009

Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long)
As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function CloseClipboard Lib "user32" () As Long

Private Sub CommandButton2_Click()

''''Sub ClearClipboard()
OpenClipboard (0&)
EmptyClipboard
CloseClipboard
''''End Sub

End Sub

regards
r

Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/...ternative.html


"jay dean" wrote:

>
> Hi - I am using Chip Pearson's code below to clear the clipboard. I have
> assigned it to a form's command control and when I compile, I get "Only
> comments may appear after End Sub, End Function, or End property."
>
> What am I doing wrong? Below is how I am using the code:
>
> Private Sub CommandButton2_Click()
>
> Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long)
> As Long
> Private Declare Function EmptyClipboard Lib "user32" () As Long
> Private Declare Function CloseClipboard Lib "user32" () As Long
>
> ''''Sub ClearClipboard()
> OpenClipboard (0&)
> EmptyClipboard
> CloseClipboard
> ''''End Sub
>
> End Sub
>
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
>

 
Reply With Quote
 
jay dean
Guest
Posts: n/a
 
      4th Jun 2009
Thank you, Rick. It was exactly what I had to do!!
Thanks, r.

Jay

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
clipboard clearing itself out Derrick Windows XP General 2 22nd Jan 2009 06:34 PM
clearing the clipboard jasondebolt@gmail.com Microsoft Excel Misc 2 25th Apr 2007 09:11 AM
clearing the clipboard =?Utf-8?B?cmF5bW9uZA==?= Windows XP Basics 17 9th Aug 2006 04:55 PM
Clearing the clipboard Avi Microsoft Excel Programming 4 18th Nov 2005 01:08 PM
Clearing Clipboard Patrick Microsoft Excel Programming 1 28th Sep 2004 01:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:03 PM.