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

E

Ed

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
 
D

Doug Robbins - Word MVP

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
 
E

Ed

Thanks, Doug. I couldn't find a reference to the "Format Picture" dialog
arguments anywhere. "Inline Shapes", huh? Makes sense, I guess - if you
work for MS and develop Word code!

Ed
 
D

Doug Robbins - Word MVP

I don't work for MS, nor do I develop Word code.

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top