Adjust the size of a picture when creating a macro

  • Thread starter macro picture will not resize
  • Start date
M

macro picture will not resize

Microsoft Office Word 2003

Attempting to create a macro to
1 paste a "Print Screen"
2 Adjust the margins to .25 (left and right)
3 turn document to landscape
4 resize the picture to fill majority of the window
5 send to a printer

I can do program all except #4 - nothing responds via use of the mouse.

This is attainable on Windows XP Home use.
 
J

Jean-Guy Marcil

macro picture will not resize was telling us:
macro picture will not resize nous racontait que :
Microsoft Office Word 2003

Attempting to create a macro to
1 paste a "Print Screen"
2 Adjust the margins to .25 (left and right)
3 turn document to landscape
4 resize the picture to fill majority of the window
5 send to a printer

I can do program all except #4 - nothing responds via use of the
mouse.

If the page is landscape, the limit for your PrintScreen picture will be its
height.

So, knowing the page size minus the top/bottom margins will give you the
maximum height the picture can have.

If you know the margins ahead of time, then fix the picture height like
this:

Selection.ShapeRange(1).Height = InchesToPoints(7)

If the picture is inline with text, then try:

Dim MyRatio As Single

MyRatio = 100 * (7 / PointsToInches(Selection.InlineShapes(1).Height))

Selection.InlineShapes(1).ScaleHeight = MyRatio
Selection.InlineShapes(1).ScaleWidth = MyRatio

If you do not know the margins ahead of time, get the number you need for
the height with:

Dim MyHeight As Single

With Selection.Sections(1).PageSetup
MyHeight = PointsToInches(.PageHeight - (.TopMargin + .BottomMargin))
End With

and use MyHeight instead of the "7" in the previous code.



--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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