NIPUL JARIWALA
Board Regular
- Joined
- Apr 22, 2016
- Messages
- 55
Hello,
I have designed a code to make a video file using PowerPoint and I run code using Excel.
But I am facing a problem.
I want to run code with Excel and I don't want PowerPoint to be appear.
I want to make it hide.
Please help me.
here is the code
Sub test1()
On Error GoTo er
Dim ppapp As PowerPoint.Application
Dim pppress As PowerPoint.Presentation
Dim ppslide As PowerPoint.Slide
Dim pic, pic1, med As Shape
Dim ppmedia As MediaFormat
Dim fs As Long
Dim effNew As Effect
Set ppapp = New PowerPoint.Application
Set pppress = ppapp.Presentations.Add
Set ppslide = pppress.Slides.Add(1, ppLayoutTitle)
'slide setup
With pppress.PageSetup
.SlideSize = ppSlideSizeA3Paper 'different types of slide format
End With
'insert picture
Set pic = pppress.Slides(1).Shapes.AddPicture("d:\1132058.jpg", msoFalse, msoTrue, 0, 0)
'crop image
pppress.Slides(1).Shapes(3).PictureFormat.CropRight = 600
Set effNew = pppress.Slides(1).TimeLine.MainSequence.AddEffect(Shape:=pic, _
EffectId:=msoAnimEffectStretchy, Trigger:=msoAnimTriggerAfterPrevious)
With effNew
With .Behaviors.Add(msoAnimTypeScale).ScaleEffect
.FromX = 75
.FromY = 75
.ToX = 0
.ToY = 0
End With
.Timing.AutoReverse = msoTrue
End With
'insert picture
Set pic1 = pppress.Slides(1).Shapes.AddPicture("d:\1.jpeg", msoFalse, msoTrue, 0, 100)
Set effNew = pppress.Slides(1).TimeLine.MainSequence.AddEffect(Shape:=pic1, _
EffectId:=msoAnimEffectStretchy, Trigger:=msoAnimTriggerAfterPrevious)
With effNew
With .Behaviors.Add(msoAnimTypeScale).ScaleEffect
.FromX = 75
.FromY = 75
.ToX = 0
.ToY = 0
End With
.Timing.AutoReverse = msoTrue
End With
Set ppslide = pppress.Slides.Add(2, ppLayoutTitle)
'insert media
Set med = pppress.Slides(2).Shapes.AddMediaObject2(Filename:="C:\Users\Surface\Downloads\Imagine for 1 Minute.mp4", _
linktofile:=True, _
savewithdocument:=False, _
Top:=200, _
Left:=0, _
Height:=550, _
Width:=1050)
Set ppmedia = med.MediaFormat
Exit Sub
er:
Application.ScreenUpdating = False
'pppress.SaveAs "C:\Users\Surface\Desktop\test.pptx"
'save as video
pppress.SaveAs _
Filename:="C:\Users\Surface\Desktop\test.mp4", _
FileFormat:=ppSaveAsMP4
fsss:
fs = FileLen("C:\Users\Surface\Desktop\test.mp4")
Application.Wait (Now + TimeValue("0:00:01"))
If fs = 0 Then
GoTo fsss
Else
GoTo cl
End If
cl:
pppress.Close
ppapp.Quit
Set ppapp = Nothing
End Sub
please help me to make PowerPoint hide.
I have designed a code to make a video file using PowerPoint and I run code using Excel.
But I am facing a problem.
I want to run code with Excel and I don't want PowerPoint to be appear.
I want to make it hide.
Please help me.
here is the code
Sub test1()
On Error GoTo er
Dim ppapp As PowerPoint.Application
Dim pppress As PowerPoint.Presentation
Dim ppslide As PowerPoint.Slide
Dim pic, pic1, med As Shape
Dim ppmedia As MediaFormat
Dim fs As Long
Dim effNew As Effect
Set ppapp = New PowerPoint.Application
Set pppress = ppapp.Presentations.Add
Set ppslide = pppress.Slides.Add(1, ppLayoutTitle)
'slide setup
With pppress.PageSetup
.SlideSize = ppSlideSizeA3Paper 'different types of slide format
End With
'insert picture
Set pic = pppress.Slides(1).Shapes.AddPicture("d:\1132058.jpg", msoFalse, msoTrue, 0, 0)
'crop image
pppress.Slides(1).Shapes(3).PictureFormat.CropRight = 600
Set effNew = pppress.Slides(1).TimeLine.MainSequence.AddEffect(Shape:=pic, _
EffectId:=msoAnimEffectStretchy, Trigger:=msoAnimTriggerAfterPrevious)
With effNew
With .Behaviors.Add(msoAnimTypeScale).ScaleEffect
.FromX = 75
.FromY = 75
.ToX = 0
.ToY = 0
End With
.Timing.AutoReverse = msoTrue
End With
'insert picture
Set pic1 = pppress.Slides(1).Shapes.AddPicture("d:\1.jpeg", msoFalse, msoTrue, 0, 100)
Set effNew = pppress.Slides(1).TimeLine.MainSequence.AddEffect(Shape:=pic1, _
EffectId:=msoAnimEffectStretchy, Trigger:=msoAnimTriggerAfterPrevious)
With effNew
With .Behaviors.Add(msoAnimTypeScale).ScaleEffect
.FromX = 75
.FromY = 75
.ToX = 0
.ToY = 0
End With
.Timing.AutoReverse = msoTrue
End With
Set ppslide = pppress.Slides.Add(2, ppLayoutTitle)
'insert media
Set med = pppress.Slides(2).Shapes.AddMediaObject2(Filename:="C:\Users\Surface\Downloads\Imagine for 1 Minute.mp4", _
linktofile:=True, _
savewithdocument:=False, _
Top:=200, _
Left:=0, _
Height:=550, _
Width:=1050)
Set ppmedia = med.MediaFormat
Exit Sub
er:
Application.ScreenUpdating = False
'pppress.SaveAs "C:\Users\Surface\Desktop\test.pptx"
'save as video
pppress.SaveAs _
Filename:="C:\Users\Surface\Desktop\test.mp4", _
FileFormat:=ppSaveAsMP4
fsss:
fs = FileLen("C:\Users\Surface\Desktop\test.mp4")
Application.Wait (Now + TimeValue("0:00:01"))
If fs = 0 Then
GoTo fsss
Else
GoTo cl
End If
cl:
pppress.Close
ppapp.Quit
Set ppapp = Nothing
End Sub
please help me to make PowerPoint hide.