I’ve been trying and failing to make a macro to resize/position images in LibreOffice Calc and was hoping someone else might be able to write one for me. I’ve taken a look at this thread and this one, but I haven’t produced anything that works. I am using 5.0.6.3.
After dragging and dropping in image into Calc, I’d like to be able to run a macro on the selected image to do a few things:
- Resize it to 3.23" width, 1.74" height (keeping aspect ratio)
- Change the x position to 1.05"
So far I have this:
Sub ChangeSize
Dim g
g = ThisComponent.CurrentSelection()
if g.supportsService("com.sun.star.text.TextGraphicObject")=false then
msgbox "please select an image"
exit sub
else
g.Width = 3.23
end if
End Sub
But I can’t get past the first part to see if the second part works… I select an image in LibreOffice Calc and run the hotkey for the macro which I’ve bound to ctrl+shift+N and the message box comes up saying please select an image even though I have one selected.