View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Determining whether a named textbox on a chart exists

On Error Resume next
set shp = MyChart.Chart.Shapes("footer")
On Error goto 0
if not shp is nothing then
' now position shp
shp.Top = ??
shp.Left = ??
end if

--
Regards,
Tom Ogilvy

"P. Dua-Brown" wrote in message
...
Hi

I'm using Excel 2003 to generate charts using vba.

On the charts I've created I add a few textboxes that I've named:

myChart.Chart.Shapes.AddTextbox(msoTextOrientation Horizontal, 5, 280, 300,
10).Name = "footer"
myChart.Chart.Shapes.AddTextbox(msoTextOrientation Horizontal, 50, 2, 305,
32).Name = "Chart Title"

What I would like to do is create another macro which users can use to
reformat Charts. This involves checking that the named textbox exists

(users
may have deleted it) and if it does position it.

I can not figure out how to do this - can anyone point me in the right
direction?

Many thanks

Preeti