The macro I posted doesn’t take any other “Graphics” into account. It assumes the only thing in the DrawPages is a linked image. Remember, I called it “crude.” The error looks to me like there are graphics other than images in the report.
The report writer usually names images in the report: Image0, Image1, Image2, etc.
If this is the case, you could try to avoid things other than linked images with the following modification to the macro:
(I’m having trouble with the editor here today. Hope you can follow…)
'Rotate all images in a Base Report document preview
'uses the document drawpage to rotate images in a report
'thanks to Andrew Pitonyak and Xray
'example only
'NOTES: place in “My Macros & Dialogs”, “Standard” library to run from Macro Menu in a Base report view.
’ simple, no error checks, use at your own risk, etc.
Sub RotateImages()
Dim iDeg As Integer
Dim oDoc As Object
Dim oDP As Object
Dim oGraph As Object
Dim j As Integer
iDeg = InputBox("Rotate images how many degrees left?","Rotate Images",90)
REM Get the document draw page and then enumerate the images.
oDoc = ThisComponent
oDP = oDoc.getDrawPage()
For j=0 To oDP.getCount()-1
oGraph = oDP.getByIndex(j)
'integer degrees * 50, rotates top to left
If left(oGraph.Name,5) = "Image" then '<- do we have an image and not a drawing, etc.
oGraph.SetPropertyValue("GraphicRotation",(iDeg*50))
EndIf
Next
End Sub