Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2007

Tip: Looking for answers? Try searching our database.

access shape by name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joseph - 29 Oct 2007 22:08 GMT
Hello
My word document contains two shapes.
How to define name for each shape in word and access them using vba.
other word access using sometimes like shapes("name1")....="Mytext"

sometimes i have confusion when i insert a new shape in document.
shape(1)  becomes shape(2)
Jean-Guy Marcil - 30 Oct 2007 03:07 GMT
joseph was telling us:
joseph nous racontait que :

> Hello
> My word document contains two shapes.
[quoted text clipped - 3 lines]
> sometimes i have confusion when i insert a new shape in document.
> shape(1)  becomes shape(2)

Sorry, I hit ALT-S before I was done... Anybody knows how to remove that
shortcut from OE? It happens a lot to me... butter fingers..

I was going to correct the code, with he Selection object you have to use
the ShapeRange property... Sorry about that.

   Selection.ShapeRange(1).Name = "myName"

As I was writing, use the following code to refer to the shape later in your
code:

   ActiveDocument.Shapes("theNameYouUsed").(Some method/property)....
like:
   ActiveDocument.Shapes("myName").Fill.ForeColor = wdColorBlack
etc.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.