View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Darren Hill[_3_] Darren Hill[_3_] is offline
external usenet poster
 
Posts: 68
Default Rename Textbox on Worksheets

There are some callouts that are still autoshapes, but have an
.autoshapetype of
msoShapeRoundedRectangularCallout (for example).


That's a snappy name. Just rolls off the tongue, doesn't it? :)
And wow, there are a lot of them!
Thanks for illuminating this. I have a question, but it's not that
important if you have other people to help.
In your macro, when I type in the sequence:

For Each shp In wks.Shapes
If shp.Type =

I get a list of possible shape types. The first one is msoAutoshape, the
second is msoCallout. I just wonder which objects that msoCallout actually
applies to?

Darren


On Sat, 18 Jun 2005 06:08:53 +0100, Dave Peterson
wrote:

That seems utterly reasonable.

But it's not quite true.

There are some callouts that are still autoshapes, but have an
.autoshapetype of
msoShapeRoundedRectangularCallout (for example).

Next time you're in the VBE, hit F2 to see the objectbrowser.

Search for msoautoshapetype.

You'll see lots of constants that can be used in the autoshapetype. And
lots of
them have CallOut in their name. I didn't see anyway to group callouts
except
by actually using all their constants.




Darren Hill wrote:

Oh yes, I can see that looks safer.
Excellent - thanks :)

If I wanted to also catch the callouts (which, to be honest, I'd
forgotten
were there before that error), and rename them via a different scheme,
how
would I alter it?
I tried the following (I was optimistic!) - what should I use instead of
msoCallout?

Aha - quick test before posting: I replaced msoCallout with msoAutoshape
and it worked - a little odd. Although the Callouts did come from the
Autoshape tool on the Drawing toolbar. Is there another type of Callout?
I'm just wondering why this worked but the msoCallout line didn't.

Option Explicit
Sub testme()
Dim wks As Worksheet
Dim shp As Shape
Dim iCtr As Long, jCtr as long

Set wks = ActiveSheet
iCtr = 0: jCtr = 0
For Each shp In wks.Shapes
If shp.Type = msoTextBox Then
iCtr = iCtr + 1
shp.Name = "TB" & iCtr
End If
If shp.Type = msoCallout Then
jCtr = jCtr + 1
shp.Name = "Call" & jCtr
End If
Next shp

End Sub

Darren
On Fri, 17 Jun 2005 21:12:35 +0100, Dave Peterson
wrote:

Or close to the end...

Option Explicit
Sub testme()
Dim wks As Worksheet
Dim shp As Shape
Dim iCtr As Long
Set wks = ActiveSheet
iCtr = 0
For Each shp In wks.Shapes
If shp.Type = msoTextBox Then
iCtr = iCtr + 1
shp.Name = "TB" & iCtr
End If
Next shp
End Sub


might be a safer way to get to the textboxes.

Darren Hill wrote:

Well, despite a silly OP, we got there in the end (though I blame

you,
Dave, for not being a good enough mind reader). :)
Thanks for you help :)

Darren


--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/





--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/