Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro works inexcel 2003 but not in excel 2007 1

Status
Not open for further replies.

bbsbbs

Programmer
Apr 19, 2011
1
GB
How do I get the folloeing code which works in excel 2003 work in excel 2007. it gives error 1004 Unable to set left property of the range class. Many thanks.

K = 1
t = 1

Do While K <= UBound(chartOrder) And K <= ((nop + 1) * 2)
t = chartOrder(K, 2)
Set ch = I.ChartObjects(t)
Set chc = ch.Chart
chartLeft = ch.Left
chartTop = ch.Top
chartHeight = ch.Height
chartWidth = ch.Width
chc.CopyPicture Appearance:=xlScreen, Format:=xlPicture
NewWorkbook.Worksheets(newWSName).Activate
NewWorkbook.Worksheets(newWSName).Paste
Selection.Left = chartLeft
Selection.Top = chartTop
Selection.Height = chartHeight
Selection.Width = chartWidth
K = K + 1
Loop
 

hi,
Code:
   Dim oSHP as shape
        chc.CopyPicture Appearance:=xlScreen, Format:=xlPicture
        NewWorkbook.Worksheets(newWSName).Paste
        
        With NewWorkbook.Worksheets(newWSName)
            Set oSHP = .Shapes(.Shapes.Count)
        End With
        
        With oSHP
            .Left = chartLeft
            .Top = chartTop
            .Height = chartHeight
            .Width = chartWidth
        End With


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top