Basic macro in Impress to get current/active/selected slide?

Hi there,

I was wondering:  I am trying to write a Basic macro which inserts a rectangle in Impress in the current/active/selected slide.
But the closest I have gotten is to specify which slide# it will end up on....
How do I get the current slide?  (No success after much googling.....)

This is what I have:

Hello...

Try...

Sub InsertRectangle()
Dim s As New com.sun.star.awt.Size

    doc = ThisComponent
    dp = doc.CurrentController.CurrentPage
    obj = doc.createInstance("com.sun.star.drawing.RectangleShape")

    s.Width = 2000
    s.Height = 1000
    obj.setSize(s)

    dp.add(obj)

End Sub

http://www.pitonyak.org/oo.php

Look for OOME (open office macros explained) and download the latest version. There is a section on draw and one on impress.

⁣Sent from BlueMail ​