Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word fixed image frame size, w/ no sizing handles in VBA?

Status
Not open for further replies.

Debbie37

Technical User
Feb 23, 2002
28
US
I would like to create a form or template for users to add up to four images (separate frames), picture set to zoom or stretch to fit within size (frame size)I determine. It has to be in Word as people at sister facilities would be unlikely to have MS Access, which is where i would like to create it. I can use a table and set it's size and the image sizes w/in, but it has sizing handles allowing users to resize. Any ideas? Is this even possible?
 
Hello Debbie

What you are proposing is quite tricky to answer without seeing your form and playing around with it, and if you aren't a VBA Developer you might struggle. I think that to do it you are going to have to link your image control to something like a slider control to allow you to resize it at run time, and also link the picture size to the same control etc etc etc.

But you can do as you propose with code along the lines of below. This uses the activedocument object in conjunction with a template form so you will have to add a list to your form or similar that allows the user to pick an image and then add controls that set the value of the variables 'MyPicHeight' and 'MyPicWidth'.

Dim myPic As InlineShape

Set myPic = ActiveDocument.InlineShapes.New(Range:=Selection.Range)
With myPic
.LockAspectRatio = msoFalse
.Height = MyPicHeight
.Width = MyPicWidth
End With

myPic.Fill.UserPicture ("\\You will need to know the path to the folder where pictures are kept")

(This is mostly conjecture on my part so if anyone can point out any problems with it please let Debbie know so that she doesn't waste any time over it)

Not brilliant I know but I hope it helps....

Asjeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top