Consulting

Results 1 to 12 of 12

Thread: Power Point Generation with Excel

  1. #1
    VBAX Regular
    Joined
    Oct 2013
    Posts
    6
    Location

    Power Point Generation with Excel

    Hello,i'm currently trying to create with VBA an automation of my ppt. I copied paste with link from Excel to Ppt the informations i needed.What i'm trying to do is to make the ppt poping up when the user click on the commandbutton. This is something i suceed to do.But i fell like the information doesn't automaticly update and furthermore i don't succeed to delete the links.Can you help me? Private Sub CommandButton1_Click() Sheets("Feuil2").Visible = True' Application.Goto Reference:="Nomsauv" Nomsauv = Selection.Offset(0, 0).Value 'Opening Ppt Document Set appPowerPointApplication = New PowerPoint.Application bPowerPointisOpened = True appPowerPointApplication.Visible = True appPowerPointApplication.Presentations.Open Filename:=ThisWorkbook.Path & "\XX.ppt", ReadOnly:=True bPowerPointPresentationsIsOpened = True Dim oSlide As Slide Dim oShape As Shape For Each oSlide In appPowerPointApplication.Slides For Each oShape In oSlide.Shapes If oShape.Type >= 7 And oShape.Type

  2. #2
    VBAX Regular
    Joined
    Oct 2013
    Posts
    6
    Location
    Hello,i'm currently trying to create with VBA an automation of my ppt. I copied paste with link from Excel to Ppt the informations i needed.What i'm trying to do is to make the ppt poping up when the user click on the commandbutton. This is something i suceed to do.But i fell like the information doesn't automaticly update and furthermore i don't succeed to delete the links.Can you help me? Private Sub CommandButton1_Click() Sheets("Feuil2").Visible = True' Application.Goto Reference:="Nomsauv" Nomsauv = Selection.Offset(0, 0).Value 'Opening Ppt Document Set appPowerPointApplication = New PowerPoint.Application bPowerPointisOpened = True appPowerPointApplication.Visible = True appPowerPointApplication.Presentations.Open Filename:=ThisWorkbook.Path & "\XX.ppt", ReadOnly:=True bPowerPointPresentationsIsOpened = True Dim oSlide As Slide Dim oShape As Shape For Each oSlide In appPowerPointApplication.Slides For Each oShape In oSlide.Shapes If oShape.Type >= 7 And oShape.TypeoShape.LinkFormat.BreakLinkEnd IfNext oShapeNext oSlide Sheets("Feuil2").Visible = False End Sub

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    For others, also posted a few days ago at http://www.mrexcel.com/forum/excel-q...row-range.html

    for monzat/florrian
    some light reading: http://www.excelguru.ca/content.php?184

    Try:
    Private Sub CommandButton1_Click()
    Sheets("Feuil2").Visible = True
    ' Application.Goto Reference:="Nomsauv"
    Nomsauv = Selection.Offset(0, 0).Value
    'Opening Ppt Document
    Set appPowerPointApplication = New PowerPoint.Application
    bPowerPointisOpened = True
    appPowerPointApplication.Visible = True
    Set myPPT = appPowerPointApplication.Presentations.Open(Filename:=ThisWorkbook.Path & "\XX.ppt", ReadOnly:=True)
    bPowerPointPresentationsIsOpened = True
    Dim oSlide As Slide
    Dim oShape  ' As Shape
    For Each oSlide In myPPT.Slides
      For Each oShape In oSlide.Shapes
        If oShape.Type >= 7 And oShape.Type <= 12 Then
          oShape.LinkFormat.BreakLink
        End If
      Next oShape
    Next oSlide
    Sheets("Feuil2").Visible = False
    End Sub
    but note that you've opened the presentation as read-only so you can only save it under another name.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    VBAX Regular
    Joined
    Oct 2013
    Posts
    6
    Location
    Thanks for your answer.

    Unfortunatly i can't open your link.

    Concerning the read only i'll a Line of code to rename the file.

    Regards.

  5. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Quote Originally Posted by monzat View Post
    Thanks for your answer.

    Unfortunatly i can't open your link.
    You're right, neither can I!. The site must be down for a while. Here's another similar link:
    http://www.excelfox.com/forum/f25/me...-posters-1172/
    It's not needed for the answer to your problem. Did the code work?

  6. #6
    VBAX Regular
    Joined
    Oct 2013
    Posts
    6
    Location
    Hello,sorry for the delay. Actually i tried what you wrote.But it sill says "Type Incompatibiliy" Error Nb 13.Maybe the code to delete the links is not the right, i saw many different codes to do that.Thanks for your help!!!!

  7. #7
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    1. If you click Debug when you get the error, which line of the code is highlighted in yellow?
    2. What version of Excel are you using?
    3. What version of PowerPoint are you using?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  8. #8
    VBAX Regular
    Joined
    Oct 2013
    Posts
    6
    Location
    What is strange is that i don't have the possibility to debug. It seems that the code executes until the end, the ppt opens but an error message appears after it's been executed.But i'm sure that the issue is on the Breaklink part.I'm using 2003 version of both.Thanks for your help.

  9. #9
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    The BreakLink method wasn't introduced until Office 2007.
    I don't have a solution for you.
    Perhaps if the copy/paste is done in vba (or manually, for that matter) you do not paste link in the first place.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  10. #10
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    The BreakLink method wasn't introduced until Office 2007.
    I don't have a solution for you.
    Perhaps if the copy/paste is done in vba (or manually, for that matter) you do not paste link in the first place.

    Compicated, but this might help:
    http://www.vbaexpress.com/forum/show...linked-version
    or similar:
    http://www.vbaexpress.com/forum/show...inks-Code-Help
    and different:
    http://www.vbaexpress.com/forum/show...ak-image-links

    ps I notice that your code is uncannily similar to the code here:
    http://www.xtremevbtalk.com/showthread.php?t=315898
    where there is the comment:
    "Oops. I just discovered a much simpler approach for 2007 from an old post (this didn't work for 2003)."
    Last edited by p45cal; 10-30-2013 at 09:08 AM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  11. #11
    VBAX Regular
    Joined
    Oct 2013
    Posts
    6
    Location
    Thanks i'll have a look.In an other file i found for a word versionappWordApplication.ActiveDocument.Fields.UnlinkDo you know the function unlink? Can it work with ppt?

  12. #12
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Quote Originally Posted by monzat View Post
    Thanks i'll have a look.In an other file i found for a word versionappWordApplication.ActiveDocument.Fields.UnlinkDo you know the function unlink? Can it work with ppt?
    No.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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