View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Phil Hageman[_3_] Phil Hageman[_3_] is offline
external usenet poster
 
Posts: 160
Default Run-time Error '1004'

Thanks for the help, Tom. Chip pointed to two mistakes I
made - carelessness on my part.

Could you answer a question: I need to manipulate the
screen position of the chart. As this code works, the
chart is positioning in the upper left corner.

Thanks, Phil

-----Original Message-----
ActiveSheet.ChartObjects("Chart13").Active

should be

ActiveSheet.ChartObjects("Chart13").Activate

or

ActiveSheet.ChartObjects("Chart13").Select

--
Regards,
Tom Ogilvy

"Phil Hageman"

wrote in message
...
Thanks for your help Chip - appreciate your time.

I entered the change, per the following, and received

Run-
time error '1004': "Unable to get the ChartObjects
property of the Worksheet class." The ActiveSheet...

line
is highlighted yellow. Did I put this in wrong?

Thanks, Phil

Sub GoToMetricsA1()
' GoToMetricsA1 Macro
Sheets("Metrics").Select
Range("A1").Select
ActiveSheet.ChartObjects("Chart13").Active
With ActiveChart.Parent
.Height = 250 'use desired height in points
.Width = 350 'use desired width in poits
.Left = (Windows(ActiveWorkbook.Name).Width -
.Width) / 2
.Top = (Windows(ActiveWorkbook.Name).Height -
.Height) / 2
End With
End Sub

-----Original Message-----
Phil,

Use

ActiveSheet.ChartObjects("Chart13").Activate
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Phil Hageman"

wrote in message
...
In the following code, I receive a compile error:

Sub or
Function not defined. In the fifth

line, "ChartObjects"
is highlighted. Can someone help me clear this problem?

Sub GoToMetricsA1()
' GoToMetricsA1 Macro
Sheets("Metrics").Select
Range("A1").Select
ChartObjects("Chart13").activate
With ActiveChart.Parent
.Height = 250 ' use desired height in points
.Width = 350 ' use desired width in points
.Left = (Windows

(ActiveWorkbook.Name).Width - _
.Width)/2
.Top = (Windows

(ActiveWorkbook.Name).Height - _
.Height)/2
End With
End Sub

.



.