Consulting

Results 1 to 12 of 12

Thread: Save an unlinked version?

  1. #1
    VBAX Newbie
    Joined
    Sep 2007
    Posts
    3
    Location

    Save an unlinked version?

    Hi,

    I have a powerpoint presentation that uses linked excel files.

    I want to create a macro that every month will save an unlinked copy of itself to the archive folder.

    Is that possible?

    I did find a thread on this forum about just preventing the update links prompt (thread 7543) which could work for the archive version, but can a macro insert a macro then save the presentation as another filename?
    Obviously I dont want my original file to stop asking to update the links.

    HYCH

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    You should be able to use [vba]ActivePresentation.SaveCopyAs (FileName)[/vba] to make a copy and then open it with vba[VBA]Presentations.Open (FileName)[/VBA]

    and break the links before a resave by searching out the linked shapes set to = oshp and
    [vba]oshp.LinkFormat.BreakLink[/vba]
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Newbie
    Joined
    Sep 2007
    Posts
    3
    Location

    Smile

    Brilliant thank you!

    I am new to this, how exactly would I find all the links?

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Something like this (not tested)


    [vba]Sub findme_andbreak()
    Dim osld As Slide
    Dim oshp As Shape
    Dim opres As Presentation
    Set opres = ActivePresentation
    opres.SaveCopyAs (Environ("USERPROFILE") & "\Desktop\backup.ppt")
    opres.Close
    Set opres = Presentations.Open(Environ("USERPROFILE") & "\Desktop\backup.ppt")
    For Each osld In opres.Slides
    For Each oshp In osld.Shapes
    If oshp.Type = msoLinkedOLEObject Then
    oshp.LinkFormat.BreakLink
    End If
    Next oshp
    Next osld
    End Sub[/vba]

    Then save and delete the temp copy on the desktop
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Newbie
    Joined
    Sep 2007
    Posts
    3
    Location
    Thanks.

    It seems to have trouble with the line:

    oshp.LinkFormat.BreakLink
    (it highlights .Breaklink )

    It says
    Method or Data Member not found

  6. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    OK I tested it this time.

    Apart from the fact you can't close the opres with the code in it! (just take that line out) it works perfectly here. What version of PowerPoint do you have. I'm on 2007 but I'm pretty sure .Breaklink was added in XP
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  7. #7
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    OK Sorry it seems this is only available in 2007
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  8. #8
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    See if this does it for you (most of the code came from fellow MVP Shyam Pillai)
    [vba]Sub breaklinks()
    Dim oSld As Slide
    Dim oShp As Shape
    Dim opres As Presentation
    Set opres = ActivePresentation
    Dim oCmdButton As CommandBarButton
    Set opres = ActivePresentation
    opres.SaveCopyAs (Environ("USERPROFILE") & "\Desktop\tempbackup.ppt")
    Set opres = Presentations.Open(Environ("USERPROFILE") & "\Desktop\tempbackup.ppt")
    Set oCmdButton = CommandBars("Standard").Controls.Add(Id:=2956)
    ActiveWindow.ViewType = ppViewSlide
    For Each oSld In opres.Slides
    For Each oShp In oSld.Shapes
    If oShp.Type = msoLinkedOLEObject Then
    ActiveWindow.View.GotoSlide oSld.SlideIndex
    oShp.Select
    Application.CommandBars.FindControl(Id:=2956).Execute
    DoEvents
    End If
    Next oShp
    Next oSld
    oCmdButton.Delete
    End Sub[/vba]
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  9. #9

    Problem with 07 Powerpoint BreakLink

    Hello,

    I am trying to write a code that automaticly break the link in PowerPoint.

    Here is a code I found online I modified the oBegin, oEnd in this code

    But it didn't work.

    Can you help!

    Sub BreakLinks()

    Dim oShp As Shape
    Dim oBegin As Integer
    Dim oEnd As Integer
    Dim oSldCount As Integer
    oSldCount = ActivePresentation.Slides.Count

    'This prompt the user to input figure size and location
    oBegin = InputBox("What is beginning page", "Beginning page", 1)
    oEnd = InputBox("What is ending page", "Ending page", oSldCount)

    For I = oBegin To oEnd
    For Each oShp In ActivePresentation.Slides(I).Shapes
    With oShp
    If .Type = msoLinkedOLEObject Then
    .LinkFormat.BreakLink
    End If
    End With
    Next oShp
    Next I
    End Sub

  10. #10
    VBAX Mentor asingh's Avatar
    Joined
    Jul 2005
    Posts
    307
    Location
    Quote Originally Posted by John Wilson
    See if this does it for you (most of the code came from fellow MVP Shyam Pillai)
    [vba]Sub breaklinks()
    Dim oSld As Slide
    Dim oShp As Shape
    Dim opres As Presentation
    Set opres = ActivePresentation
    Dim oCmdButton As CommandBarButton
    Set opres = ActivePresentation
    opres.SaveCopyAs (Environ("USERPROFILE") & "\Desktop\tempbackup.ppt")
    Set opres = Presentations.Open(Environ("USERPROFILE") & "\Desktop\tempbackup.ppt")
    Set oCmdButton = CommandBars("Standard").Controls.Add(Id:=2956)
    ActiveWindow.ViewType = ppViewSlide
    For Each oSld In opres.Slides
    For Each oShp In oSld.Shapes
    If oShp.Type = msoLinkedOLEObject Then
    ActiveWindow.View.GotoSlide oSld.SlideIndex
    oShp.Select
    Application.CommandBars.FindControl(Id:=2956).Execute
    DoEvents
    End If
    Next oShp
    Next oSld
    oCmdButton.Delete
    End Sub[/vba]
    Hi I was searching the net for a solution to break links from PPT (office 2003)..and found this thread.

    I tried the code, but the links were not removed. Should there be some more code..? Which is missing..thanks a lot for the help.

    regards,

    asingh

  11. #11
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Hi the code is complete and works here in 2003. Are you sure your link is an LinkedOLEObject?
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  12. #12
    VBAX Mentor asingh's Avatar
    Joined
    Jul 2005
    Posts
    307
    Location
    Sorry did not mention it the first time round...yes..the OLE objects..become static images, but I can still see the "links"...in the edit>>>links interface. How to get rid of that..??

Posting Permissions

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