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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing name of title from excel sheet dynamically

Status
Not open for further replies.

kingz2000

Programmer
May 28, 2002
304
DE
Hi,

I have an dynamically created excel sheet,hence, with a varying number of diagrams.

How can I remove the title name of all diagrams on the sheet via VB Code??

Please help.
Thanx.
 


Hi,

Each diagram on your sheet is a Shape Object.

Use the Watch Window to "discover" the properties available to you.

How to use the Watch Window as a Power Programming Tool faq707-4594

There is also the Object Browser and VBA Help.

Skip,

[glasses] [red]Be Advised![/red] The only distinction between a bird with one wing and a bird with two, is merely...
a difference of A Pinion! [tongue]
 
ok,

here is my code:


For Each Item In wks2.Shapes.Items
If Left(wks2.Shapes.Items.Name, 5) = "Chart" Then
wks2.Shapes.Items.Name = " "
End If
Next

whereby wks2 is my worksheet! Syntatically,, there doesn't seem to be a problem, but it doesnt like for each item..How do I get around it??


 
Have you tried something like this ?
Dim myItem
For Each myItem In wks2.Shapes.Items
...

but it doesnt like for each item
Any chance you could elaborate ?
computer crash ? error message ? unexpected behaviour ? ... ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi,


yes, sorry, the error message I get on the 'For each' statement is object or method not found.

So , I guess you are right! How exactly shall I define myItem

dim myitem as .........?
 
Either As Shape or As Variant (like I suggested).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

in both cases I get the error 438.

Object doesn't support this property or method.
 
Sorry for the typo:
For Each myItem In wks2.Shapes

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

Right, thanx!! Now that works, and I am able to pick out the 'Items' which are charts. I can even use Item(i).Type and check for 'msoChart', but I don't seem to be able to change the chart title displayed.HOw do I get to this property????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top