Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

How to resize a picture?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Vivian Carroll - 05 Jan 2005 01:28 GMT
In Word 2000 I have a macro to insert an picture that the user chooses,
select the picture , and then make the height 1" (72 pt) - keeping the width
proportional. I then want the macro to look at whether the width is greater
than 320 pt and if so, make the width exactly 320 pt - keeping the height
proportional (which means it will end up less than 1" - that's ok).

The first set of steps below work - the picture change to 1" high. The
second set of steps does not give an error message but does not do anything.
What do I need to do to make the macro resize the picture to 320 pt wide,
keeping the height proportional?

TIA,

Vivian Carroll

       'SELECT & FORMAT THE PICTURE TO BE 1" HIGH - these steps work
           With Selection
               .MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
                .InlineShapes(1).Width = Selection.InlineShapes(1).Width *
72 / _
                   Selection.InlineShapes(1).Height
                .InlineShapes(1).Height = 72

        'CHANGE THE PICTURE TO BE ABOUT 3.2" WIDE IF IT IS WIDER THAN
3.2" - these steps don't work
               If .InlineShapes(1).Width > 320 Then
                   .InlineShapes(1).Height =
Selection.InlineShapes(1).Height * 320 / _
                            Selection.InlineShapes(1).Width
                   .InlineShapes(1).Width = 320
              End If

       End With

End Sub
Jonathan West - 05 Jan 2005 01:36 GMT
Hi Vivian

It looks to me as if you have your unit conversions wrong. 3.2" is about
230pt, not 320pt.

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> In Word 2000 I have a macro to insert an picture that the user chooses,
> select the picture , and then make the height 1" (72 pt) - keeping the
[quoted text clipped - 34 lines]
>
> End Sub
Vivian Carroll - 06 Jan 2005 04:15 GMT
Boy do I feel stupid! Of course, that was the problem. Thanks for helping,
Jonathan!

Vivian

> Hi Vivian
>
[quoted text clipped - 39 lines]
> >
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.