Results 1 to 10 of 10
  1. #1
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reverting back to original size for inline shape (Word XP)

    I'm trying to programatically adjust the size of some OLE objects. Manually, this is pretty simple. The attached screenshots show how a person can manually do this. In this example, the original size was 2.7" but has somehow been reduced to 1.7".

    Naturally, it'd be nice if I am just allowed to shut off the ratio lock and just set the width to 2.7". But the width of the objects varies. So I need to set the 63% to 100%. Problem is that I cannot figure out how to do this in VBA. When I use the .ScaleWidth property on the InlineShape, it scales it based on the current width (in this case, 1.7"). I'd love to use the .ScaleWidth method available to Shapes, but I cannot convert these to Shapes. I have to work in the confines of the InlineShape.

    Does anyone know how to simply set the value to be 100% (or any other percentage?)

    Kevin

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Reverting back to original size for inline sha

    No time to play right now, but what does that Reset button do? Is there a VBA equivalent?

  3. #3
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reverting back to original size for inline sha

    There is .Reset, but it didn't set the size = to original size. I didn't play with it too much, but I guess it's useful if I change the brightness or size in other manners. Programatically, I don't see the purpose to Reset just yet. I suppose that if someone tinkers with a graphic, it might be nice to have a toolbar that just runs .Reset. Save a few extra clicks.

    I've circumvented this problem. I just used an InputBox and asked the user to enter the width value. It's imperfect, but it'll get the job done.

    Now, I'm just hoping to see a solution because I'm downright curious. Maybe you cannot change the width to be equal to the original width.

    Kevin

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Reverting back to original size for inline sha

    Hi Kevin,

    Try something like:

    Sub Reformat()
    On Error Resume Next
    For i = 1 To ActiveDocument.InlineShapes.Count
    With ActiveDocument.InlineShapes(i)
    .ScaleHeight = 100
    .ScaleWidth = 100
    End With
    Next
    MsgBox "Finished Reformatting."
    End Sub

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Reverting back to original size for inline sha

    Er - macropod, am I missing something here? Kevin said at the start (I checked, and he's right) that .scalewidth and .scaleheight are not available to inlineshapes - so what is the point of your sub?
    By telling it to change a property that doesn't exist and jump any lines that cause errors all you do is jump the lot, surely? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>
    Beryl M


  6. #6
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reverting back to original size for inline sha

    Macropod's code seems to work fine on Office 2000, Beryl.

    Alan

  7. #7
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Reverting back to original size for inline sha

    Hi Beryl,

    It works for me - apart from a change in scaling factor, I been using this same macro with inline shapes quite a bit lately.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  8. #8
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Reverting back to original size for inline sha

    Maybe it's v97 then - but I haven't tried to use it (believe it or not, in my quick test I couldn't make the radio button 'shape' I put in a doc become an 'inlineshape' in the few minutes I took off to try it!), I was just commenting, logically, on the two facts (.scalewidth not available and errorcatcher jumping error lines) apparently making the entire macro pointless.

    Maybe it's just me. I'm very tired at the moment <img src=/S/snore.gif border=0 alt=snore width=32 height=15> due to loads of overtime at work, but don't have the sense to go to bed when I can (note the time I'm posting this).

    Night night.
    Beryl M


  9. #9
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Reverting back to original size for inline sha

    See my reply to Alan. Too tired to repeat it. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>
    Beryl M


  10. #10
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Reverting back to original size for inline sha

    Hi Beryl,

    The 'on error' just stops the macro crashing with an error message if no inlineshapes are found or if for some reason a particular shape can't be re-sized.

    Cheers
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •