Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Warn if no text in clipboard contents

I have the following sub (Excel 2007):
ActiveSheet.PasteSpecial Format:="Text"

It fails if there is no text to paste. I'd like a MsgBox to prompt the user
if there is no text. How do I do this?

Also, is there some way I can warn if the text will paste to more than one
cell?

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Warn if no text in clipboard contents

Function ValueOnly()
if Application.CutCopyMode = False then
msgbox "Nothing to paste"
else
ActiveSheet.PasteSpecial Format:="Text"
End if
End Function

--
Gary''s Student - gsnu2007L


"John" wrote:

I have the following sub (Excel 2007):
ActiveSheet.PasteSpecial Format:="Text"

It fails if there is no text to paste. I'd like a MsgBox to prompt the user
if there is no text. How do I do this?

Also, is there some way I can warn if the text will paste to more than one
cell?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Warn if no text in clipboard contents

I can help with your first question:-

If Application.ClipboardFormats(1) = -1 Then
MsgBox "Clipboard Empty!"
End If

--
Alan Moseley IT Consultancy
http://www.amitc.co.uk

If I have solved your problem, please click Yes below. Thanks.


"John" wrote:

I have the following sub (Excel 2007):
ActiveSheet.PasteSpecial Format:="Text"

It fails if there is no text to paste. I'd like a MsgBox to prompt the user
if there is no text. How do I do this?

Also, is there some way I can warn if the text will paste to more than one
cell?

Thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
The contents of the clipboard [email protected] Excel Programming 1 October 3rd 06 11:29 AM
Keep contents in clipboard Kenny Excel Programming 0 September 20th 05 08:45 PM
warn me when text appears steve Excel Worksheet Functions 3 April 17th 05 08:14 PM
can i get excel to warn me if text appears in 3 different cells steve Excel Worksheet Functions 1 April 17th 05 07:58 PM
Clipboard contents Basil[_2_] Excel Programming 0 October 8th 03 06:05 PM


All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"