Code VBA Untuk Gerak Shapes
Code VBA Untuk Gerak Shapes
dx = GetSystemMetrics(SM_SCREENX)
dy = GetSystemMetrics(SM_SCREENY)
sqrBlack.X = ActivePresentation.Slides(1).Shapes("square_end").left
sqrBlack.Y = ActivePresentation.Slides(1).Shapes("square_end").top
Drag selectedShape
' Paste the original text while maintaining its formatting, back to the shape
If selectedShape.HasTextFrame Then selectedShape.TextFrame.TextRange.Paste
DoEvents
End Sub
With ActivePresentation.PageSetup
dx = (WR.lRight - WR.lLeft) / .SlideWidth
dy = (WR.lBottom - WR.lTop) / .SlideHeight
Select Case True
Case dx > dy
sx = sx + (dx - dy) * .SlideWidth / 2
dx = dy
Case dy > dx
sy = sy + (dy - dx) * .SlideHeight / 2
dy = dx
End Select
End With
StartTime = Timer
While dragMode
GetCursorPos mPoint
selectedShape.left = (mPoint.X - sx) / dx - selectedShape.Width / 2
selectedShape.top = (mPoint.Y - sy) / dy - selectedShape.Height / 2
ActivePresentation.Slides(1).Shapes(ADD_SHAPE_TO_DISPLAY_POSITION_HER
E).TextFrame.TextRange = "X: " + CStr(left) + " Y:" + CStr(top)
With sqrBlack
ActivePresentation.Slides(1).Shapes(ADD_SHAPE_TO_DISPLAY_END_POSITION_H
ERE).TextFrame.TextRange = "X:" + CStr(.X) + " Y:" + CStr(.Y)
End With
' Comment out the next line if you do NOT want to show the countdown text within the
shape
If selectedShape.HasTextFrame Then selectedShape.TextFrame.TextRange.Text =
CInt(DropInSeconds - (Timer - StartTime))
ActivePresentation.Slides(1).Shapes(ADD_SHAPE_NAME_FOR_COUNTDOWN_HE
RE).TextFrame.TextRange.Text = CInt(DropInSeconds - (Timer - StartTime))
DoEvents
If Timer > StartTime + DropInSeconds Then
dragMode = False
Wend
DoEvents
End Sub