Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2005

Tip: Looking for answers? Try searching our database.

Can not run Macro written in Excel 2003 on Excel 2002

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WayneF - 27 Jan 2005 15:56 GMT
   Hi all,

   I have recorded the following Macro ....

Sub Paste_TSR()
'
' Paste_TSR Macro
' Macro recorded 27/01/2005 by WayneF
'

'
   Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
       SkipBlanks:=False, Transpose:=False
   Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
       SkipBlanks:=False, Transpose:=False
   Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
       :=False, Transpose:=False
End Sub

   Basically it just paste's the clip board content's to the given position
with out pasting this formulas. The problem is when I try to use this file
in Excel 2000 or Excel 2002 I get this error ...

   Run-time error '1004':
   PasteSpecial method of Range class failed

   When I go to the debug the following selection is highlighted ...

   Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
       SkipBlanks:=False, Transpose:=False

   I guess its some kind of compatibility problem ... Can anyone help me to
over come this.

   I hope I have been precise enough

   Cheers,

   Wayne
Gord Dibben - 27 Jan 2005 17:04 GMT
Wayne

As written your macro will not work in either 2003 or 2002 for me.

You need something to paste.

Add  Selection.Copy before the first Selection.PasteSpecial line.

Gord Dibben Excel MVP

>    Hi all,
>
[quoted text clipped - 36 lines]
>
>    Wayne
WayneF - 27 Jan 2005 18:00 GMT
   Hi Gord,

   I dont want to define the copy part, The user should go and start the
copy and then position the cursor at the paste area and just hit the button.
The I want the values and NOT the formula pasted.

   P.S. It works fine in 2003 just not in porevios version

   Thanks for your help !

   Cheers,

   Wayne

> Wayne
>
[quoted text clipped - 50 lines]
>>
>>    Wayne
Gord Dibben - 27 Jan 2005 19:08 GMT
Gotcha.

I read it as if you were just copying in place.

I see Bernie's zeroed in on the problem.

Gord

>    Hi Gord,
>
[quoted text clipped - 64 lines]
>>>
>>>    Wayne
Bernie Deitrick - 27 Jan 2005 17:07 GMT
Wayne,

This was a bug in XL2000/02, where xlPasteColumnWidths was never defined.
Instead, you need to use the hardcoded value 8 as the option to pastespecial

HTH,
Bernie
MS Excel MVP

>     Hi all,
>
[quoted text clipped - 36 lines]
>
>     Wayne
WayneF - 27 Jan 2005 18:11 GMT
   Cheers Bernie,

   Your years of hard work have payed of for me :)

   Thanks a lot for your help, Just got it working a treat !

   Cheers,

   Wayne

> Wayne,
>
[quoted text clipped - 51 lines]
>>
>>     Wayne
Dave Peterson - 27 Jan 2005 23:13 GMT
Fixed in xl2002, actually.

> Wayne,
>
[quoted text clipped - 4 lines]
> Bernie
> MS Excel MVP

<<snipped>>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.