Board index » delphi » Word:Selection.HeaderFooter.Shapes-cannot select the shape

Word:Selection.HeaderFooter.Shapes-cannot select the shape

here is my code for pasting a bitmap into the header then selecting and
resizing it:

var t:tbitmap;
AFormat: Word;
AData: THandle;
APalette: HPALETTE;
begin
t:=tbitmap.create;
t.assign(modcenik.tnastavitve.fieldbyname('Logo'));
t.SaveToClipboardFormat(aformat,adata,apalette);
clipBoard.SetAsHandle(aformat,AData);
w.ActiveWindow.ActivePane.View.Type:=$00000003;// wdPageView, postavitev
strani
w.ActiveWindow.ActivePane.View.SeekView:=$00000009;//
wdSeekCurrentPageHeader
w.selection.paste;
t.free;
w.ActiveDocument.Shapes[0].Select; //error

w.selection.ShapeRange.ScaleWidth(0.35,false,);
w.selection.ShapeRange.ScaleHeight(0.35,false,);
w.ActiveWindow.ActivePane.View.SeekView:=$00000000;// wdSeekMainDocument

end;

when I try to select it it displays:item is not a property.
I've tried the following: shapes[0].select, shapes.item[0].select,
shapes('Picture 1').select
and none works (seems that shapes is not a property nor a method?).

What to do?

Thanks,
 Marko.

 

Re:Word:Selection.HeaderFooter.Shapes-cannot select the shape


I have Word 2000 and Shapes.Item is a function that works like this:

var
  Index : olevariant;
  AShape : Shape;
begin
  Index := <YourIndexValue>;
  AShape := Shapes.Item (Index);

have fun
--
Binh Ly
Visit my COM Notes at http://www.castle.net/~bly/com

Quote
Marko Lesnik <gradb...@siol.net> wrote in message

news:37FCE97E.407D9267@siol.net...
Quote
> here is my code for pasting a bitmap into the header then selecting and
> resizing it:

> var t:tbitmap;
> AFormat: Word;
> AData: THandle;
> APalette: HPALETTE;
> begin
> t:=tbitmap.create;
> t.assign(modcenik.tnastavitve.fieldbyname('Logo'));
> t.SaveToClipboardFormat(aformat,adata,apalette);
> clipBoard.SetAsHandle(aformat,AData);
> w.ActiveWindow.ActivePane.View.Type:=$00000003;// wdPageView, postavitev
> strani
> w.ActiveWindow.ActivePane.View.SeekView:=$00000009;//
> wdSeekCurrentPageHeader
> w.selection.paste;
> t.free;
> w.ActiveDocument.Shapes[0].Select; file://error

> w.selection.ShapeRange.ScaleWidth(0.35,false,);
> w.selection.ShapeRange.ScaleHeight(0.35,false,);
> w.ActiveWindow.ActivePane.View.SeekView:=$00000000;// wdSeekMainDocument

> end;

> when I try to select it it displays:item is not a property.
> I've tried the following: shapes[0].select, shapes.item[0].select,
> shapes('Picture 1').select
> and none works (seems that shapes is not a property nor a method?).

> What to do?

> Thanks,
>  Marko.

Other Threads