Macro to Rotate Image in Word 365

Ann Allen 21 Reputation points
2021-12-09T10:11:31+00:00

Ho do I write a macro to rotate an image in Word 365.

Recording the actions doesn't work.

I have many images that I want to rotate, not all at once, but selectively.

Thanks

Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
876 questions
{count} votes

Accepted answer
  1. Viorel 110.1K Reputation points
    2021-12-10T17:51:01.577+00:00

    Check a macro that rotates the current (selected) picture by 45°:

    Sub Macro1()
    
        Const angle = 45
    
        Dim s As Shape
    
        For Each s In Selection.ShapeRange
            s.IncrementRotation angle
        Next
    
        Dim inl As InlineShape
    
        For Each inl In Selection.InlineShapes
            Set s = inl.ConvertToShape
            s.IncrementRotation angle
            s.ConvertToInlineShape
        Next
    
    End Sub
    

    You can also assign a value to s.Rotation.

    Backup your document before tests.


2 additional answers

Sort by: Most helpful
  1. Ann Allen 21 Reputation points
    2021-12-10T06:07:49.037+00:00

    Thank you, but I'd already found those, and they are still not helping.

    https://www.msofficeforums.com/word-vba/37197-picture-inserting-resizing-rotating-macro-depending-height.html
    I don't want/need to insert/resize nor is height dependancy an issue

    https://stackoverflow.com/questions/50439698/vba-macro-to-increment-rotation-of-selected-shape-picture-in-powerpoint
    I don't want to increment, and even so, it doesn't work for me

    https://stackoverflow.com/questions/39725621/vba-rotate-word-shapes-in-a-word-document
    This one ends up rotating multiple images - gathered in a shaperange

    https://www.datanumen.com/blogs/6-effective-ways-batch-rotate-multiple-images-word-document/
    Don't want to rotate multiple images

    https://codedocu.com/Details?d=1734&a=8&f=234&l=0&v=d
    This one imports the picture, checks height/width - far more than I want it to do. I tried extracting parts, but still can't get it to work.


  2. Ann Allen 21 Reputation points
    2021-12-10T17:00:06.42+00:00

    Thanks John, but I can't believe it is so difficult.

    With a mouse it's easy: click PictureFormat, click the rotate button, click rotate right. All I want to do is turn that into Ctrl-Shift-R.

    3 mouse strokes might seem like a small job, but with many pictures to rotate, I'd like an easier way. 15 years ago I could write macros all day long in Lotus 1-2-3.

    0 comments No comments