> I assume that you have dimmed oShape as a Shape. That being the case, just
> refer to oShape.
[quoted text clipped - 12 lines]
> > LinkToFile:=False, _
> > DisplayAsIcon:=False)
Try assigning a bookmark to it. But YOU will have to remember the name of
the bookmark

Signature
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.
Hope this helps,
Doug Robbins - Word MVP
> Let's say I add the shape, save and close the document and then open it
> again
[quoted text clipped - 21 lines]
>> > LinkToFile:=False, _
>> > DisplayAsIcon:=False)
dcuthill was telling us:
dcuthill nous racontait que :
> Let's say I add the shape, save and close the document and then open
> it again later. How do I know which shape was tghe one I added in the
> previous session - especially if I have a number of such shapes? Can
> I not give the shape a specific name when it is inserted?
As Doug wrote, with inline shapes the best bet is to use a bookmark. Set a
range to the inserted shape and assign a bookmark, use a constant in the
code for the bookmark name.
Otherwise, if you can work with floating shapes, the Name property is handy.
I have done this many times and it works like a charm later, as in:
'_______________________________________
Const ShapeName As String = "MyShapeName"
Dim oShape As Shape
Dim MyRange As Range
Set MyRange = Selection.Paragraphs(1).Range
Set oShape = ActiveDocument.Shapes.AddShape(Type:=msoShapeRectangle, _
Left:=50, Top:=50, Width:=100, Height:=200, Anchor:=MyRange)
oShape.Name = ShapeName
ActiveDocument.Shapes(ShapeName).Select
'_______________________________________

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
dcuthill - 24 Nov 2004 18:25 GMT
I have tried to implement your suggestions. This code is giving an error when
I try to assign the name to the shape "method or data member not found". Any
ideas?
Const ShapeName As String = "MyShapeName"
Dim xlApp As Excel.Application
Dim oWordDoc As Word.Document
Dim oShape As Word.InlineShape
Dim oGraphChart As Excel.Chart
Dim oWorkbook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim Rng As Word.Range
Dim TabCnt As Long
Dim i As Long
WindowUpdating (False) 'to freeze the screen
Set oWordDoc = ActiveDocument
TabCnt = oWordDoc.Tables.Count
For i = 1 To TabCnt Step 4
Set Rng = ActiveDocument.Tables(i).Range
Rng.Copy
Rng.Collapse wdCollapseEnd
Rng.InsertAfter "" & vbCrLf
Rng.Collapse wdCollapseEnd
Set oShape = Rng.InlineShapes.AddOLEObject _
(ClassType:="Excel.Chart.8", _
FileName:="", _
LinkToFile:=False, _
DisplayAsIcon:=False)
oShape.Name = ShapeName <==== Method or data member not found
> dcuthill was telling us:
> dcuthill nous racontait que :
[quoted text clipped - 25 lines]
> ActiveDocument.Shapes(ShapeName).Select
> '_______________________________________
Jean-Guy Marcil - 24 Nov 2004 19:05 GMT
dcuthill was telling us:
dcuthill nous racontait que :
> I have tried to implement your suggestions. This code is giving an
> error when I try to assign the name to the shape "method or data
> member not found". Any ideas?
Having a long day? :-)
Here is what I wrote :
<quote>
As Doug wrote, with inline shapes the best bet is to use a bookmark. Set a
range to the inserted shape and assign a bookmark, use a constant in the
code for the bookmark name.
Otherwise, if you can work with floating shapes, the Name property is handy.
I have done this many times and it works like a charm later, as in:
<unquote>
I meant that the Name property is not available to inline shapes, which is
what you are using.

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
dcuthill - 24 Nov 2004 19:13 GMT
Okay, okay, okay ... now I understand.
> dcuthill was telling us:
> dcuthill nous racontait que :
[quoted text clipped - 17 lines]
> I meant that the Name property is not available to inline shapes, which is
> what you are using.