Excel vba to hide powerpoint automation

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.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top