Consulting

Results 1 to 10 of 10

Thread: To Convert Excel to PPT

  1. #1

    Thumbs up To Convert Excel to PPT

    Hi all,

    I want to convert an excel workbook to ppt using Excel VBA.Please let me know how to accomplish this.


    Thanks & Regards,
    Abhi ram

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Can I ask why you would want to do this rather than just "linking" ppt to the Excel workbook?

  3. #3
    Quote Originally Posted by OBP
    Can I ask why you would want to do this rather than just "linking" ppt to the Excel workbook?
    If I link the PPT to excel, then i need to double click the charts in ppt to update them if am correct.

    So if i can convert the xls to ppt then I thought it will be ok..

    Please let me know if there is any method to accomplish this.

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    I always used to do all of the updating in Excel, which is then automatically picked up by ppt via the link.
    I do not know of any way to convert to ppt, you certainly do not appear to be able to "save as".
    Perhaps someone else with more VB experiance can help.
    If you do not get any other responses I would suggest a private mail to Firefyter.

  5. #5
    Quote Originally Posted by OBP
    I always used to do all of the updating in Excel, which is then automatically picked up by ppt via the link.
    I do not know of any way to convert to ppt, you certainly do not appear to be able to "save as".
    Perhaps someone else with more VB experiance can help.
    If you do not get any other responses I would suggest a private mail to Firefyter.
    Thanks. I will let you know if dont get any responses.

    Regards,
    Abhi Ram

  6. #6
    VBAX Mentor Marcster's Avatar
    Joined
    Jun 2005
    Posts
    434
    Location
    Does this thread help?:

    http://www.vbaexpress.com/forum/showthread.php?t=7012

    Marcster.

  7. #7
    Knowledge Base Approver VBAX Expert brettdj's Avatar
    Joined
    May 2004
    Location
    Melbourne
    Posts
    649
    Location
    You can export graphs from PP to excel (linked or as a picture) with this kb article
    http://vbaexpress.com/kb/getarticle.php?kb_id=370

    Cheers

    Dave

  8. #8
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    I think you might want to define the requirement in a little more detail.
    You can to go though each collection of objects on a sheet (charts, shapes, etc) and copy/paste them across to a PowerPoint slide (as suggested, paste-linking the charts would mean you can still update them in Excel). The used ranges could also be checked and put in PowerPoint as tables.
    You'd have to decide how to define the layout of the page but in principle, it's do-able with something like[VBA]Dim ws As Worksheet
    Dim appPPT As PowerPoint.Application
    Dim pptPres As PowerPoint.Presentation
    Dim pptSld As PowerPoint.Slide
    Dim shp As Shape

    Set appPPT = New PowerPoint.Application
    Set pptPres = appPPT.Presentations.Add

    For Each ws In ActiveWorkbook.Sheets
    ' add a slide
    Set pptSld = pptPres.Slides.Add(pptPres.Slides.Count + 1, ppLayoutTitleOnly)
    ' update the title
    With pptSld.Shapes.Placeholders
    If .Count > 0 Then
    With .Item(1)
    If .PlaceholderFormat.Type = ppPlaceholderTitle Then
    .TextFrame.TextRange = ws.Name
    End If
    End With
    End If
    End With
    ' copy/paste over the shapes
    For Each shp In ws.Shapes
    shp.Copy
    pptSld.Shapes.Paste
    ' to do - scale & position shape here
    Next shp

    'copy paste ranges?

    Next ws

    ' to do - save here

    Set pptSld = Nothing
    Set pptPres = Nothing
    Set appPPT = Nothing[/VBA]
    K :-)

  9. #9
    Quote Originally Posted by Killian
    I think you might want to define the requirement in a little more detail.
    You can to go though each collection of objects on a sheet (charts, shapes, etc) and copy/paste them across to a PowerPoint slide (as suggested, paste-linking the charts would mean you can still update them in Excel). The used ranges could also be checked and put in PowerPoint as tables.
    You'd have to decide how to define the layout of the page but in principle, it's do-able with something like[vba]Dim ws As Worksheet
    Dim appPPT As PowerPoint.Application
    Dim pptPres As PowerPoint.Presentation
    Dim pptSld As PowerPoint.Slide
    Dim shp As Shape

    Set appPPT = New PowerPoint.Application
    Set pptPres = appPPT.Presentations.Add

    For Each ws In ActiveWorkbook.Sheets
    ' add a slide
    Set pptSld = pptPres.Slides.Add(pptPres.Slides.Count + 1, ppLayoutTitleOnly)
    ' update the title
    With pptSld.Shapes.Placeholders
    If .Count > 0 Then
    With .Item(1)
    If .PlaceholderFormat.Type = ppPlaceholderTitle Then
    .TextFrame.TextRange = ws.Name
    End If
    End With
    End If
    End With
    ' copy/paste over the shapes
    For Each shp In ws.Shapes
    shp.Copy
    pptSld.Shapes.Paste
    ' to do - scale & position shape here
    Next shp

    'copy paste ranges?

    Next ws

    ' to do - save here

    Set pptSld = Nothing
    Set pptPres = Nothing
    Set appPPT = Nothing[/vba]
    Hi ,

    This is want am looking for.. but can I select more than one shape at a time?

    Thanks & Regards,
    Abhi Ram

  10. #10
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    You can. I've assumed an automated process, so this code goes through each shape in turn. You can test the shape to find it's type and decide whether you want to copy/paste it or not.
    To do it all in one go, you could build a list of each shape you want, group them and copy/paste the group - although you can add things to the selection object easily enough[VBA]' copy/paste over the shapes
    For Each shp In ws.Shapes
    If shp.Type = msoChart Then
    'add charts only to the selection
    shp.Select False
    End If
    Selection.Copy
    pptSld.Shapes.Paste
    Next shp[/VBA]
    K :-)

Posting Permissions

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