Word 2007 VBA or VB.Net Picture Scale Setting RRS feed

  • Question

  • On the Picture Tools dialog in the Scale group there are two checkboxes. One is for locking the aspect ratio and the other for scaling relative to the original size.

    I'm trying to find the Scale Relative to Original Size property setting and set it in a VB routine. I can't seem to find it ... anyone know how?

    Kind Regards, Rich ...
    Friday, August 12, 2011 4:35 PM


All replies

  • Hi Rich,

    This KB article maybe helps:

    In this article, Shape.ScaleWidth method is used to scale a picture to full size, with "Relative to original"

    I look forward  to hearing of you.

    Best Regards, Calvin Gao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, August 15, 2011 6:41 AM
  • Thank you Calvin, that is helpful. I’m glad I now know where that setting is.

    FWIW I don’t agree with the documentation regarding when to use the “true” setting on relative to original size for pictures and OLE objects because that’s the issue I was trying to overcome.  Further the implied functionality of it doesn’t jive with my experience.

    I wrote a routine that takes a PowerPoint slide and pastes a copy of it into a Word document. Optionally it will also, in the Word document, adjust the size of the image, put a frame around it, etc.  The VB.Net commands are sld.Copy (sld is the PowerPoint slide object) and rng.Paste (rng is the Word document range.)

    In Word 2010 the end result is a 3.75” x 5” image with an inline shape type of MsoPicture.  Later if the user wants to resize images I search for MsoPicture types and adjust the rng.inlineshapes(1).scaleheight by simply adding or subtracting from its current value.  This works exactly the same way a user might do it if they were performing this manually from the dialog.  And all of this was with no change to a “Relative to Original” Boolean value.  In fact if you try this manually yourself, just use one of the sample picture that loads with Word and choose one that has an original size that’s larger than the final inserted copy.  The Jellyfish is one.  You’ll see that you do not have to change the Relative to Original checkbox.  You can scale the image up or down by adding or subtracting from the scale percent.

    In Word 2007 the same code would not run because first, the copied PowerPoint slide comes in as an OLE object type, and second, after temporarily adjusting code to allow for the other object type, it pasted into the document in a 3.75” x 5” size but maintained an original size setting of 3.24 x 5.9 and then would only resize from that original size … thus leading to my original question, which was in essence “Where is that darn setting?”

    So you’ve answered my specific question … thank you!  And unfortunately I’ve decided I can’t use it.

    In Word 2007 the core problem is the shape type and I’ve found that the solution is to do the following:

            If addOk = True Then
              addOk = False
              rng.MoveStart(Unit:=Word.WdUnits.wdParagraph, Count:=1)
              rng.Select() 'added for Word 2007 issue with shape type
              rng.Fields.Unlink() 'added for Word 2007 issue with shape type
            End If


     Selecting and then unlinking converts the shape type to Mso Picture, something Word 2010 must do automatically.  Once that is done everything else works and initially both the current and original sizes are equal.

    Kind Regards, Rich ...
    Monday, August 15, 2011 10:07 PM