How to get power point slide dimension using vba? How to get power point slide dimension using vba? vba vba

How to get power point slide dimension using vba?


The presentation's .PageSetup.SlideWidth and .SlideHeight properties will give you the dimensions of the slide in points.

Your function would need to do something like (off top of head and out of the air ..):

Function IsOffSlide (oSh as Shape) as Boolean  Dim sngHeight as single  Dim sngWidth as Single  Dim bTemp as Boolean  bTemp = False ' by default  With ActivePresentation.PageSetup    sngHeight = .SlideHeight    sngWidth = .SlideWidth  End With  ' this could be done more elegantly and in fewer lines   ' of code, but in the interest of making it clearer  ' I'm doing it as a series of tests.  ' If any of them are true, the function will return true  With oSh    If .Left < 0 Then       bTemp = True    End If    If .Top < 0 Then       bTEmp = True    End If    If .Left + .Width > sngWidth Then       bTemp = True    End If    If .Top + .Height > sngHeight Then       bTemp = True    End If  End With  IsOffSlide = bTempEnd Function


Why you not use a placeholders of PowerPoint to make this? for example:

Sub SetText(IndexOfSlide As Integer, txt As String)'http://officevb.com       ActivePresentation.Slides(IndexOfSlide).Shapes.Placeholders(1).TextFrame.TextRange.Text = txtEnd Sub

You can call this sub and pass parameters

IndexOfSlide with a number of slide and txt with a text to create.