+ Reply to Thread
Results 1 to 5 of 5

Autoupdate Excel links in PowerPoint

Hybrid View

  1. #1
    Registered User
    Join Date
    01-30-2012
    Location
    N Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Autoupdate Excel links in PowerPoint

    Hi All,

    I am a new user and have very low knowledge of coding VBA, but I can understand coded VBA.

    I am writing a code and need help with the following:

    My code is working fine if I try to open the PPT through Excel and is update the existing excel links in it. However, I want that as soon as the PPT is opened, Autoupdate function makes the excel-links as automatic, and just before closing the PPT, autoupdate function makes it manual.

    Sub UpdateAustria()
    Dim pApp As Object
    Dim pPreso As Object
    Dim pSlide As Object
    Dim shp As Object
    Dim sld As Object
    Dim sPreso As String
    
    sPreso = "C:\Macro Report\Matrix January.ppt"
    
    On Error Resume Next
    Set pApp = GetObject(, "PowerPoint.Application")
    
    'If Err.Number <> 0 Then
    Set pApp = CreateObject("PowerPoint.Application")
    pApp.Visible = True
    'End If
    
    On Error Resume Next
    Set pPreso = pApp.Presentations(sPreso)
    
    'If Err.Number <> 0 Then
    Set pPreso = pApp.Presentations.Open(Filename:=sPreso)
    'End If
    
    On Error GoTo 0
            For Each sld In ActivePresentation.Slides
            For Each shp In pPreso.Shapes
            If shp.Type = msoLinkedOLEObject Then
            shp.LinkFormat.AutoUpdate = ppUpdateOptionAutomatic
            End If
            Next shp
            Next sld
    
    pPreso.UpdateLinks
    pPreso.Save
    pPreso.Close
    
    End sub

  2. #2
    Registered User
    Join Date
    01-30-2012
    Location
    N Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Autoupdate Excel links in PowerPoint

    Hi,

    I have not got any reply on this but if anyone can look and help me with this. I have tried modifying the code. For some reasons, the PPT is opening fine but as soon as the code enters For loop, it stops working (pls see the updated code below).

    Any help on this will be much appreciated. Thanks.

    Sub UpdateAustria()
    Dim pApp As Object
    Dim pPreso As Object
    Dim pSlide As Object
    Dim sPreso As String
    Dim i As Integer
    Dim k As Integer
    
    sPreso = "C:\Macro Report\Matrix January.ppt"
    
    
    On Error Resume Next
    Set pApp = GetObject(, "PowerPoint.Application")
    
    'If Err.Number <> 0 Then
    Set pApp = CreateObject("PowerPoint.Application")
    pApp.Visible = True
    'End If
    
    On Error Resume Next
    Set pPreso = pApp.Presentations(sPreso)
    
    'If Err.Number <> 0 Then
    Set pPreso = pApp.Presentations.Open(Filename:=sPreso)
    'End If
    
        For i = 1 To pPreso.Slides.Count
            With pPreso.Slides(i)
                For k = 1 To .Shapes.Count
                 If .Shapes(k).Type = msoLinkedOLEObject Then
                    .Shapes(k).LinkFormat.AutoUpdate = ppUpdateOptionAutomatic
                    .UpdateLinks
                    .Shapes(k).LinkFormat.AutoUpdate = ppUpdateOptionManual
                End If
                    On Error GoTo 0
                Next k
            End With
        Next i
    
    pPreso.Save
    pPreso.Close
    
    End Sub

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Autoupdate Excel links in PowerPoint

    Do you get an error when it stops working? What exactly do you mean by stops working?
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Registered User
    Join Date
    01-30-2012
    Location
    N Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Autoupdate Excel links in PowerPoint

    Yes, I get an error. Enclosed is the snapshot of the error.

    Pls help.

    Macro Error.JPG

  5. #5
    Registered User
    Join Date
    01-30-2012
    Location
    N Delhi, India
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Autoupdate Excel links in PowerPoint

    Hi Mordred, would you mind looking into this.

    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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