I have the below code and its not opening the actaul ppt file but openiong it as Presetation 1. any suggestion as how to modify the code so that I actual open's the correct PPT file and do the need copy and paste.
VBA Code:
Sub CreatePowerPoint()
Dim mySlide As PowerPoint.Slide
Dim myShapeRange As PowerPoint.Shape
Dim oPA As PowerPoint.Application
Dim oPP As PowerPoint.Presentation
Dim oPS As PowerPoint.SlideRange
Dim strTemplate As String
Dim rng As Range
strTemplate = "C:\Viral Shah\Automation\Weekly Report\Fixed Weekly Report.pptx" [B]' not opening this file[/B]
Set oPA = New PowerPoint.Application [B]'This is creating a new preseation and do the copy and past[/B]
oPA.Visible = msoTrue
'changed this line to assign the new presentation to your variable
Set oPP = oPA.Presentations.Open(strTemplate, untitled:=msoTrue)
'If Not oPS Is Nothing Then Set oPS = Nothing
'If Not oPP Is Nothing Then Set oPP = Nothing
'If Not oPA Is Nothing Then Set oPA = Nothing
Err_PPT:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
Resume Next
End If
Set rng = ThisWorkbook.Sheets("OLTFinal Report").Range("A1:U37")
Set mySlide = oPP.Slides(2)
rng.Copy
'mySlide.Shapes.PasteSpecial (ppPastePicture)
mySlide.Shapes.PasteSpecial (ppPasteBitmap)
Set myShapeRange = mySlide.Shapes(mySlide.Shapes.Count)
myShapeRange.LockAspectRatio = msoFalse
myShapeRange.Left = 20
myShapeRange.Top = 80
myShapeRange.Height = 400
myShapeRange.Width = 680
Application.CutCopyMode = False
End Sub