Marcin Janowski
Marcin Janowski

Reputation: 94

PowerPoint VBA - SlideRange position on a screen

I am creating a PPT Add-In and I am struggling to find the answer whether it is possible to determine the SlideRange position on a screen.

I would like to have a userform to be opened in a particular position (for example left = 10, top = 10 starting from left-top corner of the SlideRange). Unfortunatelly its position is based on a screen resolution. As the resolution can be changed and the PPT view type may be modified I am unable to establish the accurate position of SlideRange.

Is it possible to do with VBA?

Thanks in advance! MJ

Upvotes: 0

Views: 1027

Answers (2)

Stephen Rindsberg
Stephen Rindsberg

Reputation: 131

<< Do you know if it is possible to catch mouse events in PPT?

Only if the mouseclick changes the selection, and as you know, that's NOT all the time.

There's probably some way of doing it via the Win API but nothing like this is built into PPT itself.

Upvotes: 1

Steve Rindsberg
Steve Rindsberg

Reputation: 3528

SlideRange has no particular position ... it's a collection of slides, and it's unclear what units you're using when you want to position the form at 10,10. But in normal full screen view, you can get the slide show window coordinates in points like so:

With SlideShowWindows(1) Debug.Print .Left Debug.Print .Top Debug.Print .Height Debug.Print .Width End With

To get the results in screen pixels you have to use a Win API call to get the screen DPI (dots per inch).

Inches = Points / 72 Pixels = Inches * DPI

Upvotes: 1

Related Questions