im currently having problems with some visual basic stuff. I have successfully added the shape to my current Powerpoint slide using the following code:
dim pres as Microsoft.Office.Interop.Powerpoint
dim slide as pres.ActivePresentation.Slides(1)
With slide.Shapes.AddShape(Type:=Microsoft.Office.Core.MsoAutoShapeType.msoShapeActionButtonCustom, Left:=50, Top:= 50, Width:=70, Height:=30)
.Name="Test"
End With
So what i want to do now is the function, whenever it is clicked (in presentation mode) it should call a Sub named "test()" defined in the same class. I am not able to that. All i can do for now is call a macro from the presentation using the following code:
dim pres as Microsoft.Office.Interop.Powerpoint
dim slide as pres.ActivePresentation.Slides(1)
With slide.Shapes.AddShape(Type:=Microsoft.Office.Core.MsoAutoShapeType.msoShapeActionButtonCustom, Left:=50, Top:= 50, Width:=70, Height:=30)
.Name="Test"
With .ActionSettings(PowerPoint.PpMouseActivation.ppMouseClick)
.Run = "test"
.Action = PowerPoint.PpActionType.ppActionRunMacro
End With
End With
But since i do not have any macros in my presentation this will result in an error. When i manually add a macro using the integrated visual basic editor in powerpoint it just works the way i intended.
Is there any way to directly call a Sub from within my visual basic code without having to create a macro?
I hope i made myself clear and you guys understood my problem.
Thanks in advance.