Thanks for your help Fluff. It has to be either my laptop or the version of excel I'm using.
At least I know the code works.
Thanks for your help Fluff. It has to be either my laptop or the version of excel I'm using.
At least I know the code works.
Sure. How do I get it to you?
On Error Resume Next 'Important
'Initialize the Scorecards for Printing Tab
Set scorecardsheet = Sheets("Scorecard")
Set specialsheet = Sheets("Specials")
Set printSheet = Sheets("Scorecards")
If Not printSheet Is Nothing Then
printSheet.Delete 'delete it if it exists
End If
'Create a new sheet
Set printSheet = Sheets.Add
printSheet.Name = "Scorecards"
On Error GoTo 0
With printSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.3)
.BottomMargin = Application.InchesToPoints(0.3)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.CenterHorizontally = True
.CenterVertically = False
.Order = xlOverThenDown
End With
Display More
Thank you for the correction. Most appreciated.
So here's more information. I loaded the spreadsheet on another laptop that is running Office 2010 and it works fine.
My code dynamically creates the "Scorecards" sheet and I'm wondering if I've got some type of protection or security issue with my installation of Excel (2010) preventing the paste.
Any ideas?
I have a worksheet with a picture on it named "special". I want to copy this image/shape to another worksheet and then reposition it. The 2nd worksheet exists and the object is named "special"
It seems pretty straightforward. There are plenty of examples on OzGrid. But when I try to paste it I get an error.
Here is the code:
Sub CopyPictureToScorecard(TargetCells As Range)
Dim p As Shape
Dim p2 As Shape
Dim TargetWS As Worksheet
Dim ShapesWS As Worksheet
Set TargetWS = Sheets("Scorecards")
Set ShapesWS = Sheets("Specials")
ShapesWS.Shapes("special").Copy
TargetWS.Paste
'make sure the picture is properly centered on the scorecard
Set p2 = TargetWS.Shapes(TargetWS.Shapes.Count)
p2.Width = p.Width
p2.Height = p.Height
p2.Top = TargetCells.Top + (TargetCells.Height / 2) - (p2.Height / 2)
p2.Left = TargetCells.Left + (TargetCells.Width / 2) - (p2.Width / 2)
p2.Line.Visible = False
End Sub
Display More
It failed on the paste. This worked fine on another PC. Might this be a permission problem?