Prev: How do I close modal dialog in Power Point 2007 or 2003?
Next: web collections missing in powerpoint 2003
From: Naro25 on 22 Apr 2010 06:45 Hello all, I am an absolute beginner to VB and trying to write a one off program. I wonder could someone please help me with the following simple code. My issue is I wrote a working code to automate an animation within powerpoint i.e VBA and need to transfer it to a user form in VB2008 so that a simple button click will open ppt and perform the following actions. The code to open powerpoint with a blank side and apply the ppt object library isnt a problem, just a continuous list of error in below code about activewindow and msoTrue/False not defined. Any help with this matter would be extremely appreciated! Sub ImportPicRenameLocateAnimate2() Dim oSlide As Slide Dim oPicture As shape Dim shp1 As shape Dim sResponse As String Dim interEffect As Effect ActiveWindow.View.GotoSlide 1 Set oSlide = ActiveWindow.Presentation.Slides(1) Set oPicture = oSlide.Shapes.AddPicture("X.JPG", _ msoFalse, msoTrue, 1, 1, 1, 1) ' Now scale the picture to full size, with "Relative to original ' picture size" set to true for both height and width. oPicture.ScaleHeight 1, msoTrue oPicture.ScaleWidth 1, msoTrue Set shp1 = ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 104.88, 326.75, 198.38, 102#) With shp1 .Name = "Zone1" .Fill.Transparency = 1# .Line.Visible = msoFalse .Height = 141.75 .Width = 141.75 End With With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ trigger:=msoAnimTriggerOnShapeClick) interEffect.shape = oPicture With interEffect .EffectParameters.Direction = msoAnimDirectionLeft .Timing.Duration = 0.5 End With End With With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ trigger:=msoAnimTriggerOnShapeClick) interEffect.shape = oPicture With interEffect .EffectParameters.Direction = msoAnimDirectionLeft .Timing.Duration = 0.5 .Exit = msoTrue End With End With With ActivePresentation.PageSetup oPicture.Select End With 'Rename image' With ActiveWindow.Selection.ShapeRange(1) sResponse = InputBox("new name ...", "Rename Shape", .Name) Select Case sResponse ' blank names not allowed Case Is = "" Exit Sub ' no change? Case Is = .Name Exit Sub Case Else On Error Resume Next .Name = sResponse If Err.Number <> 0 Then MsgBox "Unable to rename this shape" End If End Select End With With ActivePresentation.Slides(1).Shapes("X") .Top = 0 .Left = 0 .Height = 271.75 .Width = 453.38 .Line.Visible = msoTrue .Line.ForeColor.SchemeColor = ppForeground .Line.BackColor.RGB = RGB(255, 255, 255) End With End Sub
From: Steve Rindsberg on 22 Apr 2010 11:31 In article <653FEC6A-F658-4378-AB93-81C3AFBBB9B6(a)microsoft.com>, Naro25 wrote: > Hello all, > > I am an absolute beginner to VB and trying to write a one off program. I > wonder could someone please help me with the following simple code. My issue > is I wrote a working code to automate an animation within powerpoint i.e VBA > and need to transfer it to a user form in VB2008 so that a simple button > click will open ppt and perform the following actions. > The code to open powerpoint with a blank side and apply the ppt object > library isnt a problem, just a continuous list of error in below code about > activewindow and msoTrue/False not defined. I don't use VB.net of any vintage so can't give you exact instructions, but it might help if you posted your code to open PPT etc. Presumably it's getting an object reference to the PowerPoint app and presentation, and most likely the code below needs to be modified to work with that object reference; right now, it's written to run within PowerPoint. > > Any help with this matter would be extremely appreciated! > > Sub ImportPicRenameLocateAnimate2() > > Dim oSlide As Slide > Dim oPicture As shape > Dim shp1 As shape > Dim sResponse As String > Dim interEffect As Effect > > ActiveWindow.View.GotoSlide 1 > > Set oSlide = ActiveWindow.Presentation.Slides(1) > Set oPicture = oSlide.Shapes.AddPicture("X.JPG", _ > msoFalse, msoTrue, 1, 1, 1, 1) > ' Now scale the picture to full size, with "Relative to original > ' picture size" set to true for both height and width. > oPicture.ScaleHeight 1, msoTrue > oPicture.ScaleWidth 1, msoTrue > > Set shp1 = > ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 104.88, > 326.75, 198.38, 102#) > With shp1 > .Name = "Zone1" > .Fill.Transparency = 1# > .Line.Visible = msoFalse > .Height = 141.75 > .Width = 141.75 > End With > > > With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) > Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ > trigger:=msoAnimTriggerOnShapeClick) > interEffect.shape = oPicture > > With interEffect > .EffectParameters.Direction = msoAnimDirectionLeft > .Timing.Duration = 0.5 > End With > End With > > > With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) > Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ > trigger:=msoAnimTriggerOnShapeClick) > interEffect.shape = oPicture > > With interEffect > .EffectParameters.Direction = msoAnimDirectionLeft > .Timing.Duration = 0.5 > .Exit = msoTrue > End With > End With > > With ActivePresentation.PageSetup > oPicture.Select > End With > > 'Rename image' > With ActiveWindow.Selection.ShapeRange(1) > sResponse = InputBox("new name ...", "Rename Shape", .Name) > Select Case sResponse > ' blank names not allowed > Case Is = "" > Exit Sub > ' no change? > Case Is = .Name > Exit Sub > Case Else > On Error Resume Next > .Name = sResponse > If Err.Number <> 0 Then > MsgBox "Unable to rename this shape" > End If > End Select > End With > > With ActivePresentation.Slides(1).Shapes("X") > .Top = 0 > .Left = 0 > .Height = 271.75 > .Width = 453.38 > .Line.Visible = msoTrue > .Line.ForeColor.SchemeColor = ppForeground > .Line.BackColor.RGB = RGB(255, 255, 255) > End With > > End Sub ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: Naro25 on 24 Apr 2010 12:35 Many thanks for your input Steve. I have the same question posted on VBforums but can't get a response there either. IYO can you recommend the best port of call forum for this? Thanks. "Steve Rindsberg" wrote: > In article <653FEC6A-F658-4378-AB93-81C3AFBBB9B6(a)microsoft.com>, Naro25 wrote: > > Hello all, > > > > I am an absolute beginner to VB and trying to write a one off program. I > > wonder could someone please help me with the following simple code. My issue > > is I wrote a working code to automate an animation within powerpoint i.e VBA > > and need to transfer it to a user form in VB2008 so that a simple button > > click will open ppt and perform the following actions. > > The code to open powerpoint with a blank side and apply the ppt object > > library isnt a problem, just a continuous list of error in below code about > > activewindow and msoTrue/False not defined. > > I don't use VB.net of any vintage so can't give you exact instructions, but it > might help if you posted your code to open PPT etc. Presumably it's getting an > object reference to the PowerPoint app and presentation, and most likely the > code below needs to be modified to work with that object reference; right now, > it's written to run within PowerPoint. > > > > > Any help with this matter would be extremely appreciated! > > > > Sub ImportPicRenameLocateAnimate2() > > > > Dim oSlide As Slide > > Dim oPicture As shape > > Dim shp1 As shape > > Dim sResponse As String > > Dim interEffect As Effect > > > > ActiveWindow.View.GotoSlide 1 > > > > Set oSlide = ActiveWindow.Presentation.Slides(1) > > Set oPicture = oSlide.Shapes.AddPicture("X.JPG", _ > > msoFalse, msoTrue, 1, 1, 1, 1) > > ' Now scale the picture to full size, with "Relative to original > > ' picture size" set to true for both height and width. > > oPicture.ScaleHeight 1, msoTrue > > oPicture.ScaleWidth 1, msoTrue > > > > Set shp1 = > > ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 104.88, > > 326.75, 198.38, 102#) > > With shp1 > > .Name = "Zone1" > > .Fill.Transparency = 1# > > .Line.Visible = msoFalse > > .Height = 141.75 > > .Width = 141.75 > > End With > > > > > > With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) > > Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ > > trigger:=msoAnimTriggerOnShapeClick) > > interEffect.shape = oPicture > > > > With interEffect > > .EffectParameters.Direction = msoAnimDirectionLeft > > .Timing.Duration = 0.5 > > End With > > End With > > > > > > With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) > > Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ > > trigger:=msoAnimTriggerOnShapeClick) > > interEffect.shape = oPicture > > > > With interEffect > > .EffectParameters.Direction = msoAnimDirectionLeft > > .Timing.Duration = 0.5 > > .Exit = msoTrue > > End With > > End With > > > > With ActivePresentation.PageSetup > > oPicture.Select > > End With > > > > 'Rename image' > > With ActiveWindow.Selection.ShapeRange(1) > > sResponse = InputBox("new name ...", "Rename Shape", .Name) > > Select Case sResponse > > ' blank names not allowed > > Case Is = "" > > Exit Sub > > ' no change? > > Case Is = .Name > > Exit Sub > > Case Else > > On Error Resume Next > > .Name = sResponse > > If Err.Number <> 0 Then > > MsgBox "Unable to rename this shape" > > End If > > End Select > > End With > > > > With ActivePresentation.Slides(1).Shapes("X") > > .Top = 0 > > .Left = 0 > > .Height = 271.75 > > .Width = 453.38 > > .Line.Visible = msoTrue > > .Line.ForeColor.SchemeColor = ppForeground > > .Line.BackColor.RGB = RGB(255, 255, 255) > > End With > > > > End Sub > > > ============================== > PPT Frequently Asked Questions > http://www.pptfaq.com/ > > PPTools add-ins for PowerPoint > http://www.pptools.com/ > > > . >
From: Steve Rindsberg on 24 Apr 2010 16:12 In article <1AFE12B6-D5F2-4644-8A0D-45269A71638F(a)microsoft.com>, Naro25 wrote: > Many thanks for your input Steve. I have the same question posted on VBforums > but can't get a response there either. IYO can you recommend the best port of > call forum for this? This might be as good a place as any, but again, unless we can see how you're opening PPT and the presentation and so on, we can't help. The exact error message might be a good thing to post also. > > Thanks. > > "Steve Rindsberg" wrote: > > > In article <653FEC6A-F658-4378-AB93-81C3AFBBB9B6(a)microsoft.com>, Naro25 wrote: > > > Hello all, > > > > > > I am an absolute beginner to VB and trying to write a one off program. I > > > wonder could someone please help me with the following simple code. My issue > > > is I wrote a working code to automate an animation within powerpoint i.e VBA > > > and need to transfer it to a user form in VB2008 so that a simple button > > > click will open ppt and perform the following actions. > > > The code to open powerpoint with a blank side and apply the ppt object > > > library isnt a problem, just a continuous list of error in below code about > > > activewindow and msoTrue/False not defined. > > > > I don't use VB.net of any vintage so can't give you exact instructions, but it > > might help if you posted your code to open PPT etc. Presumably it's getting an > > object reference to the PowerPoint app and presentation, and most likely the > > code below needs to be modified to work with that object reference; right now, > > it's written to run within PowerPoint. > > > > > > > > Any help with this matter would be extremely appreciated! > > > > > > Sub ImportPicRenameLocateAnimate2() > > > > > > Dim oSlide As Slide > > > Dim oPicture As shape > > > Dim shp1 As shape > > > Dim sResponse As String > > > Dim interEffect As Effect > > > > > > ActiveWindow.View.GotoSlide 1 > > > > > > Set oSlide = ActiveWindow.Presentation.Slides(1) > > > Set oPicture = oSlide.Shapes.AddPicture("X.JPG", _ > > > msoFalse, msoTrue, 1, 1, 1, 1) > > > ' Now scale the picture to full size, with "Relative to original > > > ' picture size" set to true for both height and width. > > > oPicture.ScaleHeight 1, msoTrue > > > oPicture.ScaleWidth 1, msoTrue > > > > > > Set shp1 = > > > ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeRectangle, 104.88, > > > 326.75, 198.38, 102#) > > > With shp1 > > > .Name = "Zone1" > > > .Fill.Transparency = 1# > > > .Line.Visible = msoFalse > > > .Height = 141.75 > > > .Width = 141.75 > > > End With > > > > > > > > > With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) > > > Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ > > > trigger:=msoAnimTriggerOnShapeClick) > > > interEffect.shape = oPicture > > > > > > With interEffect > > > .EffectParameters.Direction = msoAnimDirectionLeft > > > .Timing.Duration = 0.5 > > > End With > > > End With > > > > > > > > > With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) > > > Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ > > > trigger:=msoAnimTriggerOnShapeClick) > > > interEffect.shape = oPicture > > > > > > With interEffect > > > .EffectParameters.Direction = msoAnimDirectionLeft > > > .Timing.Duration = 0.5 > > > .Exit = msoTrue > > > End With > > > End With > > > > > > With ActivePresentation.PageSetup > > > oPicture.Select > > > End With > > > > > > 'Rename image' > > > With ActiveWindow.Selection.ShapeRange(1) > > > sResponse = InputBox("new name ...", "Rename Shape", .Name) > > > Select Case sResponse > > > ' blank names not allowed > > > Case Is = "" > > > Exit Sub > > > ' no change? > > > Case Is = .Name > > > Exit Sub > > > Case Else > > > On Error Resume Next > > > .Name = sResponse > > > If Err.Number <> 0 Then > > > MsgBox "Unable to rename this shape" > > > End If > > > End Select > > > End With > > > > > > With ActivePresentation.Slides(1).Shapes("X") > > > .Top = 0 > > > .Left = 0 > > > .Height = 271.75 > > > .Width = 453.38 > > > .Line.Visible = msoTrue > > > .Line.ForeColor.SchemeColor = ppForeground > > > .Line.BackColor.RGB = RGB(255, 255, 255) > > > End With > > > > > > End Sub > > > > > > ============================== > > PPT Frequently Asked Questions > > http://www.pptfaq.com/ > > > > PPTools add-ins for PowerPoint > > http://www.pptools.com/ > > > > > > . > > ============================== PPT Frequently Asked Questions http://www.pptfaq.com/ PPTools add-ins for PowerPoint http://www.pptools.com/
From: Naro25 on 25 Apr 2010 06:27 Sorry, to be a bit more specific, this is exactly what I'm trying to replicate in Vb.Net: With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ trigger:=msoAnimTriggerOnShapeClick) interEffect.shape = oPicture With interEffect .EffectParameters.Direction = msoAnimDirectionLeft .Timing.Duration = 0.5 End With End With With ActivePresentation.Slides(1).TimeLine.InteractiveSequences.Add(1) Set interEffect = .AddEffect(shp1, msoAnimEffectFly, _ trigger:=msoAnimTriggerOnShapeClick) interEffect.shape = oPicture With interEffect .EffectParameters.Direction = msoAnimDirectionLeft .Timing.Duration = 0.5 .Exit = msoTrue End With End With
|
Next
|
Last
Pages: 1 2 Prev: How do I close modal dialog in Power Point 2007 or 2003? Next: web collections missing in powerpoint 2003 |