LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default XL2003 "paste method of worksheet class failed"

Hello folks,

Can someone help me with what I expect is a really simple problem -

I have a small piece of code in it's own module.

The code is to be called manually once the user has copied tabular
data from another app.

The first part of the procedure is to add a worksheet & paste the
clipboard contents.

For some reason the paste method now seems to fail with "paste method
of worksheet class failed".

I checked on Google Groups and found 89 threads relating to this
problem. There doesn't seem to be a specific error people are
committing. Has this been acknowledged as a bug by Microsoft?

The most helpful response was from an MVP, Nick Hodge who mentioned
that Excel - he responds to a similar question:-

"I suspect XL has lost what it wanted to paste. You don't show us the
code for copying, but if you do much after you have copied the chances
are XL will lose it's clipboard. (It doesn't work like most other
apps). "

Really? Excel loses the clipboard contents in a random way?

===================================


Here is the part of the sub that fails:-

Sub getcolumns(colControlDate As Integer, colYear As Integer,
intColumnCount As Integer _
, Optional colCurrency As Integer, Optional
colPaid As Integer _
, Optional colOS As Integer)

Dim headings As Range
Dim tmpString As String, i As Integer


' create a new sheet so we don't overwrite existing data
Application.Worksheets.Add


'paste clipboard data into new sheet
ActiveCell.PasteSpecial (xlPasteValues)


'select first cell of data & count number of columns in the region
Range("a1").Select
intColumnCount = ActiveCell.CurrentRegion.Columns.Count

' quit if clipboard did not produce at least 3 cols
If intColumnCount < 3 Then
MsgBox ("No columns of data found in Windows Clipboard")
Exit Sub
End If

end sub

========================================

Thanks in advance for any help,
Rob
 
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
"Select method of Range class failed" Error Ayo Excel Discussion (Misc queries) 3 September 2nd 08 07:58 PM
"Copy Method of worksheet class failed" Ron McCormick[_6_] Excel Programming 8 November 24th 04 11:29 AM
VBA error 1004 "Select method of Range class failed" Matt J Excel Programming 6 July 3rd 04 10:05 PM
Error 1004, "select method of range class failed" paritoshmehta[_11_] Excel Programming 3 May 6th 04 10:09 PM
Runtime Error "1004" Select Method of Range Class Failed Stephen[_7_] Excel Programming 4 April 10th 04 06:28 AM


All times are GMT +1. The time now is 02:07 AM.

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

About Us

"It's about Microsoft Excel"