eduardodanon
11-23-2015, 07:08 AM
Hello, everybody!
I have the following code to maximize a shape to the slide area. The problem is that it is covering the title. How could i change it to not cover it?
I tried changing the line
.Top = 0.5 * (myPresentation.PageSetup.SlideHeight - .Height)
for the following
.Top = 0.4 * (myPresentation.PageSetup.SlideHeight - .Height)
but for some reason that i dont know, some ranges do not get copied this way
Set myPresentation = PowerPointApp.ActivePresentation
NewWidth = myPresentation.PageSetup.SlideWidth
NewHeight = myPresentation.PageSetup.SlideHeight
With shp
If .Width > NewWidth Then
.LockAspectRatio = msoTrue
.Width = NewWidth - 100
End If
If .Height > NewHeight Then
.LockAspectRatio = msoTrue
.Height = NewHeight - 100
End If
If 3 * .Width > 4 * .Height Then
.Width = myPresentation.PageSetup.SlideWidth
.Top = 0.5 * (myPresentation.PageSetup.SlideHeight - .Height)
Else
.Height = myPresentation.PageSetup.SlideHeight
.Left = 0.5 * (myPresentation.PageSetup.SlideWidth - .Width)
End If
End With
'Center Object
With myPresentation.PageSetup
shp.Left = (.SlideWidth \ 2) - (shp.Width \ 2)
shp.Top = (.SlideHeight \ 2) - (shp.Height \ 2)
End With
Next x
I have the following code to maximize a shape to the slide area. The problem is that it is covering the title. How could i change it to not cover it?
I tried changing the line
.Top = 0.5 * (myPresentation.PageSetup.SlideHeight - .Height)
for the following
.Top = 0.4 * (myPresentation.PageSetup.SlideHeight - .Height)
but for some reason that i dont know, some ranges do not get copied this way
Set myPresentation = PowerPointApp.ActivePresentation
NewWidth = myPresentation.PageSetup.SlideWidth
NewHeight = myPresentation.PageSetup.SlideHeight
With shp
If .Width > NewWidth Then
.LockAspectRatio = msoTrue
.Width = NewWidth - 100
End If
If .Height > NewHeight Then
.LockAspectRatio = msoTrue
.Height = NewHeight - 100
End If
If 3 * .Width > 4 * .Height Then
.Width = myPresentation.PageSetup.SlideWidth
.Top = 0.5 * (myPresentation.PageSetup.SlideHeight - .Height)
Else
.Height = myPresentation.PageSetup.SlideHeight
.Left = 0.5 * (myPresentation.PageSetup.SlideWidth - .Width)
End If
End With
'Center Object
With myPresentation.PageSetup
shp.Left = (.SlideWidth \ 2) - (shp.Width \ 2)
shp.Top = (.SlideHeight \ 2) - (shp.Height \ 2)
End With
Next x