Re: Can't find proper object(?)/methods(?) for Format Picture?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Doug Robbins - Word MVP (dkr_at_NOmvpsSPAM.org)
Date: 04/08/04


Date: Fri, 9 Apr 2004 09:41:50 +1000

Hi Ed,

Here's a bit of code that inserts a logo into a cell of a table in the
header of a document and then adjusts the size of that logo so that it suits
the size of the cell.

'Insert Logo on Title Page
        myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.Delete
        myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes.AddPicture Filename:=txtLargeLogoPath
'Adjust size of logo to match avalable space
        oheight =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
        owidth =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
            If oheight < InchesToPoints(2) Then
                With
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
                    .Height = InchesToPoints(2)
                    .Width = owidth * InchesToPoints(2) / oheight
                End With
            End If
        oheight =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Height
        owidth =
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1).Width
            If owidth > InchesToPoints(2.85) Then
                With
myDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(1,
1).Range.InlineShapes(1)
                    .Width = InchesToPoints(2.85)
                    .Height = oheight * InchesToPoints(2.85) / owidth
                End With
            End If

Note that the object that is acted upon is and InlineShape. In this case,
getting hold of it was easy because it was the only InlineShape in the
.Range of the first cell in the first row of the first table in the Header
of the first section of the document.

-- 
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
"Ed" <> wrote in message news:OQnD8nYHEHA.3476@TK2MSFTNGP11.phx.gbl...
>I am pasting in several Enhanced Metafile pictures.  I need to set a 
>certain
> formatting on all of them.  I'd like to put it into a macro (vs. wearing 
> out
> my right-click!), but I can't seem to find the right object or method 
> terms
> to access the parameters.  Can someone drop-kick me in the right 
> direction,
> please?
>
> Ed
>
> 


Relevant Pages

  • Re: Footer problem
    ... Try experimenting by putting an In Line table in the Header with the logo in one cell and the text in other cells. ... >>> company information in the footer. ...
    (microsoft.public.word.pagelayout)
  • Re: VBA to re-size all (inline) images in a document?
    ... the cell of a table and then adjusts the size, ... ratio so that it fits in the cell. ... 'Insert Logo on Title Page ...
    (microsoft.public.word.vba.beginners)
  • Re: Non-Table Oriented Data Entry Form Example Needed
    ... Say the objective isa simple two colum layout ... with a logo at the top and a footer at the bottom. ... > left middle cell, whatever I want for the foot into the lowest row. ...
    (microsoft.public.frontpage.client)
  • Re: How do I put logo with address info next to it?
    ... "Suzanne S. Barnhill" wrote in message ... You then insert the graphic in the first cell and the text in the adjacent cell. ... I can get the bear logo on the paper all day ... >I am trying to create a letterhead for my husband's business. ...
    (microsoft.public.word.pagelayout)
  • Re: stylesheet in frontpage
    ... Is the image the same height as the table cell? ... > logo I need to replace ... "Sandra Hendsbee" wrote in message ... >>> Can cell height be defined on a style sheet? ...
    (microsoft.public.frontpage.client)