Part way through building a routine which generates a pre-formatted presentation file. Getting a compile error: Argument not optional at the point of inserting a picture.
Any help greatly appreciated.
Sub CreatePresentation()
'Declarations
Dim pptApp As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation
Dim strFile As String
Dim pptSlide As PowerPoint.Slide
Dim pptShape As PowerPoint.Shape
Dim strPathname1, strPathname2, strPathname3, strPathname4, strPathname5, strPathname6, _
strPathname7, strPathname8, strPathname9, strPathname10, strPathname11, strPathname12, _
strPathname13, strPathname14, strPathname15, strPathname16, strPathname17, strPathname18, _
strPathname19 As String
Dim ClientFolder, ClientCode, ClientNo As String
Dim ImageTitle1, ImageTitle2, ImageTitle3, ImageTitle4, ImageTitle5, ImageTitle6, ImageTitle7, _
ImageTitle8, ImageTitle9, ImageTitle10, ImageTitle11, ImageTitle12, ImageTitle13, ImageTitle14 _
, ImageTitle15, ImageTitle16, ImageTitle17, ImageTitle18, ImageTitle19 As String
'Statements
strFile = "C:\Users\Desktop\Presentation.ppt"
ClientFolder = "C:\Users\Sheets("SourceData").Range("B6").Value
ClientCode = Sheets("Quotation").Range("c426").Value
ClientNo = Sheets("SourceData").Range("B6").Value
ImageTitle1 = ClientNo + "_Survey1.jpg"
'ImageTitle2 ...etc
strPathname1 = ClientFolder + "\SURVEY NOTES\" + ImageTitle1
'strPathname2 ....etc
'Actions
Set pptApp = New PowerPoint.Application
pptApp.Visible = True
Set pptPres = pptApp.Presentations.Open(strFile)
pptApp.Activate
'Process
On Error Resume Next
With pptPres.Slides(1)
.Select
.Shapes.AddPicture Filename:=("strPathname1,msoCTrue, msoCTrue") 'Compile Error highlights ".AddPicture"
End With
'Set pptApp = Nothing
End Sub
Bookmarks