Rotate inlineshape

G

Gem_man

Is it possible to programmatically rotate an inlineshape picture (in fact all
pictures) in a specific section on a word doc?

I cannot find anything in the vba help section.

Thanks in advance
 
G

Gem_man

Jezabel

Thank you for that, its certainly put me on the right track but I get an
error message:

Runtime error 5852
Requested object not available

When trying out other formats of photograph I also get a "Permission Denied"
message.

I have tried to sort this out myself, to no avail.

I also notice that I cannot manually rotate a photograph that I have
inserted into a doc either when its an inlineshape or a shape.

However I can manually rotate an inserted autoshape.

Has this got something to do with it?

Any suggestions?

Regards
Adrian
 
Joined
Sep 5, 2021
Messages
2
Reaction score
0
ActiveDocument.Sections(n).Range.ShapeRange.Rotation = x
It is frustrating that code is uploaded that does not work. This does work, not sure if it is as clean or simple as it needs to be, but I need to add a pop up so you can enter 90 or 180 or 270 degrees as the rotation is once only (unless you undo before saving but this defeats the time saving of the macro), I also may look to undo the original InlineShape settings as infuriatingly if someone manually rotates an image prior to the macro, the rotation is applied according to the InlineShape's original position which can question your sanity, so not safe to roll out to other colleagues until this problem is removed This one rotates all images in the Active document, need to resave the Macro or amend so only a selected image is rotated as this might be a possibility, R Macro for Rotate all and r Macro to rotate just one image (assuming case sensitivity is OK for Macro names :

Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oIls As InlineShape
Dim oShp As Shape
For Each oIls In ActiveDocument.Range.InlineShapes
If oIls.Type = wdInlineShapePicture Then
With oIls
Set oShp = .ConvertToShape
oShp.Rotation = 90
Set oIls = oShp.ConvertToInlineShape
End With
End If
Next
lbl_Exit:
Exit Sub
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top