HI GUYS
am trying to add a shape in power point slide and add action (click event) to run a macro.
through power point vba, it worked perfectly and this is the code i used.
and this is the macro am trying to call
BUT IF I USE EXCELL VBA,IT FAILS!!!
THIS IS THE EXCEL CODE I USED
plus the modified macro in excel vba i intend to call
attached find a screen shots of the error
am wondering where i went wrong
kindly help. thanks!
am trying to add a shape in power point slide and add action (click event) to run a macro.
through power point vba, it worked perfectly and this is the code i used.
VBA Code:
Option Explicit
Sub ADDSHAPE()
Dim pppres As Presentation
Dim pslide As Slide
Dim pshp As Shape
Set pppres = ActivePresentation
Set pslide = pppres.Slides(1)
Set pshp = pslide.Shapes.ADDSHAPE(msoShapeRound1Rectangle, 800, 100, 100, 50)
pshp.TextFrame.TextRange.Text = "CLICK ME!"
With pshp.ActionSettings(ppMouseClick)
.Action = ppActionRunMacro
.Run = "ADDTEXTBOX"
.AnimateAction = msoCTrue
End With
End Sub
and this is the macro am trying to call
VBA Code:
Sub ADDTEXTBOX()
Dim pppres As Presentation
Dim pslide As Slide
Dim shp As Shape
Set pppres = ActivePresentation
Set pslide = pppres.Slides(1)
Set shp = pslide.Shapes.ADDTEXTBOX(msoTextOrientationHorizontal, 100, 100, 100, 50)
shp.TextFrame.TextRange.Text = "i have done it!"
End Sub
BUT IF I USE EXCELL VBA,IT FAILS!!!
THIS IS THE EXCEL CODE I USED
VBA Code:
Option Explicit
Option Base 1
Sub powerointt_animations()
Application.ScreenUpdating = False
Dim ppapp As New PowerPoint.Application
Dim pppres As PowerPoint.Presentation
Dim shp As PowerPoint.Shape
Dim sld, pslide As PowerPoint.Slide
With ppapp
.Activate
.Visible = msoCTrue
.WindowState = ppWindowMaximized
End With
Set pppres = ppapp.Presentations.Add
Set pslide = pppres.Slides.Add(1, ppLayoutBlank)
pppres.Slides(1).SlideShowTransition.AdvanceOnClick = msoFalse
Set shp = pslide.Shapes.AddShape(msoShapeRound1Rectangle, 800, 100, 100, 50)
shp.TextFrame.TextRange.Text = "CLICK ME!"
With shp.ActionSettings(ppMouseClick)
.Action = ppActionRunMacro
.Run = "ADDTEXTBOX"
.AnimateAction = msoCTrue
End With
'pppres.SlideShowSettings.Run
Application.ScreenUpdating = True
End Sub
plus the modified macro in excel vba i intend to call
VBA Code:
Sub ADDTEXTBOX()
Dim pppres As PowerPoint.Presentation
Dim pslide As PowerPoint.Slide
Dim shp As PowerPoint.Shape
'add text
Set pppres = ActivePresentation
Set shp = pslide.Shapes.ADDTEXTBOX(msoTextOrientationHorizontal, 100, 100, 100, 50)
shp.TextFrame.TextRange.Font.Color.RGB = rgbWhite
shp.TextFrame.TextRange.Text = "THATS IS IT!"
End Sub
attached find a screen shots of the error
am wondering where i went wrong
kindly help. thanks!