Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109114 > unrolled thread

Error on paste

Started byPaul Doucette <pauld@mewood.com>
First post2016-07-27 10:59 -0700
Last post2016-07-27 17:31 -0400
Articles 6 — 3 participants

Back to article view | Back to microsoft.public.excel.programming


Contents

  Error on paste Paul Doucette <pauld@mewood.com> - 2016-07-27 10:59 -0700
    Re: Error on paste Claus Busch <claus_busch@t-online.de> - 2016-07-27 20:30 +0200
    Re: Error on paste Paul Doucette <pauld@mewood.com> - 2016-07-27 11:39 -0700
      Re: Error on paste Claus Busch <claus_busch@t-online.de> - 2016-07-27 20:57 +0200
    Re: Error on paste Paul Doucette <pauld@mewood.com> - 2016-07-27 12:24 -0700
    Re: Error on paste GS <gs@v.invalid> - 2016-07-27 17:31 -0400

#109114 — Error on paste

FromPaul Doucette <pauld@mewood.com>
Date2016-07-27 10:59 -0700
SubjectError on paste
Message-ID<c0b2c55a-367a-4483-bbfa-fe4174438c5c@googlegroups.com>
This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("Sheet2").Select
ActiveSheet.Shapes("Oval 2").Select
    Selection.Copy
    Sheets("Sheet1").Select
    ActiveSheet.unprotect
    ActiveSheet.Paste
    Selection.ShapeRange.IncrementLeft -12.75
    Selection.ShapeRange.IncrementTop -30.25
    Sheets("Sheet1").Select
    ActiveCell.Offset(0, 4).Range("A1").Select
     Sheets("Sheet1").Select
    ActiveSheet.protect DrawingObjects:=False, Contents:=True, Scenarios:=True
    Application.ScreenUpdating = True
End Sub

[toc] | [next] | [standalone]


#109117

FromClaus Busch <claus_busch@t-online.de>
Date2016-07-27 20:30 +0200
Message-ID<nnaukg$l5t$1@dont-email.me>
In reply to#109114
Hi Paul,

Am Wed, 27 Jul 2016 10:59:29 -0700 (PDT) schrieb Paul Doucette:

> This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul

try:
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False

Sheets("Sheet2").Shapes("Oval 2").Copy
    
With Sheets("Sheet1")
    .Unprotect
    .Paste
    With .Shapes("Oval 2")
        .IncrementLeft -12.75
        .IncrementTop -30.25
    End With
    .Protect DrawingObjects:=False, Contents:=True, Scenarios:=True
End With
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
-- 
Windows10
Office 2016

[toc] | [prev] | [next] | [standalone]


#109119

FromPaul Doucette <pauld@mewood.com>
Date2016-07-27 11:39 -0700
Message-ID<77bcc2be-ada9-41ba-9b27-71e56314e0a2@googlegroups.com>
In reply to#109114
On Wednesday, July 27, 2016 at 1:59:49 PM UTC-4, Paul Doucette wrote:
> This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul
> 
> Private Sub CommandButton2_Click()
> Application.ScreenUpdating = False
> Sheets("Sheet2").Select
> ActiveSheet.Shapes("Oval 2").Select
>     Selection.Copy
>     Sheets("Sheet1").Select
>     ActiveSheet.unprotect
>     ActiveSheet.Paste
>     Selection.ShapeRange.IncrementLeft -12.75
>     Selection.ShapeRange.IncrementTop -30.25
>     Sheets("Sheet1").Select
>     ActiveCell.Offset(0, 4).Range("A1").Select
>      Sheets("Sheet1").Select
>     ActiveSheet.protect DrawingObjects:=False, Contents:=True, Scenarios:=True
>     Application.ScreenUpdating = True
> End Sub

Still hanging up at .Paste

[toc] | [prev] | [next] | [standalone]


#109120

FromClaus Busch <claus_busch@t-online.de>
Date2016-07-27 20:57 +0200
Message-ID<nnb06g$r3h$1@dont-email.me>
In reply to#109119
Hi Paul,

Am Wed, 27 Jul 2016 11:39:49 -0700 (PDT) schrieb Paul Doucette:

> Still hanging up at .Paste

in my workbook it is working fine.
Try:

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False

Sheets("Sheet2").Shapes("Oval 2").Copy
Sheets("Sheet1").Paste
    
With Sheets("Sheet1")
    With .Shapes("Oval 2")
        .IncrementLeft -12.75
        .IncrementTop -30.25
    End With
End With
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
-- 
Windows10
Office 2016

[toc] | [prev] | [next] | [standalone]


#109121

FromPaul Doucette <pauld@mewood.com>
Date2016-07-27 12:24 -0700
Message-ID<15dd4b18-ac84-4704-b621-5b0d352ed1b8@googlegroups.com>
In reply to#109114
On Wednesday, July 27, 2016 at 1:59:49 PM UTC-4, Paul Doucette wrote:
> This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul
> 
> Private Sub CommandButton2_Click()
> Application.ScreenUpdating = False
> Sheets("Sheet2").Select
> ActiveSheet.Shapes("Oval 2").Select
>     Selection.Copy
>     Sheets("Sheet1").Select
>     ActiveSheet.unprotect
>     ActiveSheet.Paste
>     Selection.ShapeRange.IncrementLeft -12.75
>     Selection.ShapeRange.IncrementTop -30.25
>     Sheets("Sheet1").Select
>     ActiveCell.Offset(0, 4).Range("A1").Select
>      Sheets("Sheet1").Select
>     ActiveSheet.protect DrawingObjects:=False, Contents:=True, Scenarios:=True
>     Application.ScreenUpdating = True
> End Sub

Just tried on a different machine, and it works fine there too. I'm thinking my server needs a restart.
Sorry for bothering you, and thanks very much for pointing me in the right direction!
-Paul

[toc] | [prev] | [next] | [standalone]


#109123

FromGS <gs@v.invalid>
Date2016-07-27 17:31 -0400
Message-ID<nnb98i$seq$1@dont-email.me>
In reply to#109114
> This code has worked in the past for copying an oval shape with a 
> clear background from one sheet to another. (we use it to circle info 
> we wish to draw attention to). But it recently began to error at 
> Activesheet.Paste. Any thoughts on why that might be? Or a way to 
> fix, or do differently? Thanks in advance, Paul
>
> Private Sub CommandButton2_Click()
> Application.ScreenUpdating = False
> Sheets("Sheet2").Select
> ActiveSheet.Shapes("Oval 2").Select
>     Selection.Copy
>     Sheets("Sheet1").Select
>     ActiveSheet.unprotect
>     ActiveSheet.Paste
>     Selection.ShapeRange.IncrementLeft -12.75
>     Selection.ShapeRange.IncrementTop -30.25
>     Sheets("Sheet1").Select
>     ActiveCell.Offset(0, 4).Range("A1").Select
>      Sheets("Sheet1").Select
>     ActiveSheet.protect DrawingObjects:=False, Contents:=True, 
> Scenarios:=True     Application.ScreenUpdating = True
> End Sub

Why not just draw a new shape when/as needed?

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

[toc] | [prev] | [standalone]


Back to top | Article view | microsoft.public.excel.programming


csiph-web