Re: Can't find proper object(?)/methods(?) for Format Picture?
From: Doug Robbins - Word MVP (dkr_at_NOmvpsSPAM.org)
Date: 04/08/04
- Next message: Jezebel: "Re: Defualt Text in an Input Box"
- Previous message: Doug Robbins - Word MVP: "Re: Drop Down Form Field"
- In reply to: Ed: "Can't find proper object(?)/methods(?) for Format Picture?"
- Next in thread: Ed: "Re: Can't find proper object(?)/methods(?) for Format Picture?"
- Reply: Ed: "Re: Can't find proper object(?)/methods(?) for Format Picture?"
- Messages sorted by: [ date ] [ thread ]
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 > >
- Next message: Jezebel: "Re: Defualt Text in an Input Box"
- Previous message: Doug Robbins - Word MVP: "Re: Drop Down Form Field"
- In reply to: Ed: "Can't find proper object(?)/methods(?) for Format Picture?"
- Next in thread: Ed: "Re: Can't find proper object(?)/methods(?) for Format Picture?"
- Reply: Ed: "Re: Can't find proper object(?)/methods(?) for Format Picture?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|