Results 1 to 2 of 2

Need Help to Prepare PPT from Excel Raw File through VBA???

Threaded View

Rajeshkumar R Need Help to Prepare PPT from... 10-28-2012, 09:16 AM
NickyC Re: Need Help to Prepare PPT... 10-29-2012, 10:26 PM
  1. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Need Help to Prepare PPT from Excel Raw File through VBA???

    Hi
    try this macro
    in the visual basic area, ensure ensure tools > references > powerpoint object library is selected so you can run PowerPoint code from excel


    Sub powerpoint_export()
    'ensure tools > references > powerpoint object library is selected
    
    Dim PPApp As PowerPoint.Application
    Dim PPPres As PowerPoint.Presentation
    Dim Ws As Worksheet, Sn As Long, Wsheet As Worksheet, sw As Long, sh As Long, st As Long
    
    Set PPApp = CreateObject("Powerpoint.Application")
    PPApp.Visible = True
    Set PPPres = PPApp.Presentations.Add
    PPPres.ApplyTemplate "\\Company Name\Division\Department\ProjectReviewPresentation.PPT "
    
    sw = PPPres.PageSetup.SlideWidth - 36
    sh = PPPres.PageSetup.SlideHeight - 6
    Sn = 1
    
    For Each Ws In ActiveWorkbook.Worksheets
        sh = PPPres.PageSetup.SlideHeight - 6
        Ws.Range(Ws.PageSetup.PrintArea).CopyPicture
        PPPres.Slides.Add Sn, ppLayoutTitleOnly
        With PPPres.Slides(Sn).Shapes(1).TextFrame.TextRange
            .Text = Ws.Name
            .Font.Size = 40
            .Font.Name = "Arial"
        End With
        PPPres.Slides(Sn).Shapes.Paste
        st = PPPres.Slides(Sn).Shapes(1).Top + PPPres.Slides(Sn).Shapes(1).Height + 6
        sh = sh - st
        'size to fill slide area below heading
        PPPres.Slides(Sn).Shapes(2).LockAspectRatio = msoTrue
        PPPres.Slides(Sn).Shapes(2).Width = sw
        If PPPres.Slides(Sn).Shapes(2).Height > sh Then PPPres.Slides(Sn).Shapes(2).Height = sh
        PPPres.Slides(Sn).Shapes(2).Top = st
        PPPres.Slides(Sn).Shapes.Range(2).Align msoAlignCenters, msoCTrue
        
        Sn = 1 + Sn
        
    Next Ws
    
    PPApp.WindowState = ppWindowMaximized
    
    End Sub
    Last edited by NickyC; 10-29-2012 at 10:28 PM.

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