Results 1 to 6 of 6

Compile error adding picture to powerpoint?

Threaded View

nickypatterson Compile error adding picture... 01-29-2011, 04:37 PM
romperstomper Re: Compile error adding... 01-29-2011, 05:47 PM
Andy Pope Re: Compile error adding... 01-30-2011, 07:20 AM
nickypatterson Re: Compile error adding... 01-31-2011, 07:40 AM
Andy Pope Re: Compile error adding... 01-31-2011, 08:43 AM
nickypatterson Re: Compile error adding... 01-31-2011, 02:08 PM
  1. #1
    Registered User
    Join Date
    11-09-2010
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    21

    Compile error adding picture to powerpoint?

    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
    Last edited by nickypatterson; 02-01-2011 at 05:08 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1