Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi, I'm trying to set up some macros/VBA to automate some of the standard settings we use in my new job, but I'm having a very hard time recording some of the ones to do with pictures, in particular. I know macro-recording has a hard time understanding nebulous things like right-clicking, so I worked out the keystrokes to do everything I wanted, and all was great - until I tried to record the keystrokes.

    Doing it manually, when I paste my picture and go to the text-wrapping menu, set it to 'in front of text', go to the picture position tab and 'lock anchor' (all using the keyboard, no mouse at all) it works beautifully - but as soon as I set the macro to record, the whole text-wrapping menu is greyed out and nothing I can find will allow me to get into it.

    Can anyone point me in the direction of how to access these functions while recording, or alternatively a VBA reference giving all the codes that relate to pictures and their setup?

    As you've probably guessed from the subject/description, I'm having the same trouble with chart setup in XL, so same questions apply there - pretty please!

    PS anybody know where my ginger/silver cat avatar has gone?!
    Beryl M


  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
    Quote Originally Posted by BerylM View Post
    Doing it manually, when I paste my picture and go to the text-wrapping menu, set it to 'in front of text', go to the picture position tab and 'lock anchor' (all using the keyboard, no mouse at all) it works beautifully - but as soon as I set the macro to record, the whole text-wrapping menu is greyed out and nothing I can find will allow me to get into it.
    Even with the picture selected? If the selection is lost after pasting, you may have to shift+left arrow to reselect the picture.

    Quote Originally Posted by BerylM View Post
    PS anybody know where my ginger/silver cat avatar has gone?!
    I have a bunch of old files that could include the last version. If not, it would include an earlier version. I didn't try to sort through these to see which ones had the "fleas" problem.
    [attachment=90313:BerylCat.zip]
    Attached Files Attached Files

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks, Jscher - I'll check out the pictures! I think I might even have copies on my hard drive somewhere, but I wondered why we lost all those settings, presumably in the changeover?

    Re the Word problem, yes, with the picture selected and yes, I'd used shift-left to do so. It's really weird - the entire menu just greys out as soon as I've got record macro switched on!

    The alternative is to manually write the code, but I'm afraid I'm extremely rusty at VBA anyway (haven't done any for several years) and have only just started to look at Office2007 since I started this job at the beginning of September, let alone its version of VBA! If anyone could point me in the direction of a listing giving all the options for working with a picture (or even just the code for doing the specific items I mentioned above, to get me started!) I'd be really grateful!

    Then of course I have the same problem with XL charts - I want to work with a text box in a chart (which will already exist and be selected) in order to set all four margins to 0 and have the box resize to the text content. To start with ...!

    Any and all help will be greatly appreciated!
    Beryl M


  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts
    Quote Originally Posted by BerylM View Post
    Re the Word problem, yes, with the picture selected and yes, I'd used shift-left to do so.
    I think it's related to the distinction between InlineShapes and Shapes. You could work with this code as a starting point:

    Code:
    Sub PositionPicture(iShp As Word.InlineShape)
    If iShp Is Nothing Then Exit Sub
    ' Convert inline picture to floated picture and format
    Dim shp As Word.Shape
    Set shp = iShp.ConvertToShape
    shp.WrapFormat.Type = wdWrapFront
    shp.LockAnchor = True
    Set shp = Nothing
    End Sub

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Okay, thanks, I'll try that.
    Beryl M


Posting Permissions

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