none
Open PPT in a Excel file RRS feed

  • Question

  • I have a sub , and I want to convert the ppt to PDF files, I tried te sub in a presentation , it could successfully convert it to a pdf file. but when I trie the code in Word or Excel,  it shows error type not mach. Anyone can tell me how to do it ?

    thanks

    Sub t1()
    Dim app As Object
    Set app = CreateObject("PowerPoint.Application")
    app.Visible = True
    app.Presentations.Open2007 "C:\Users\Administrator\Desktop\MonthlyView.ppt", msoFalse
    app.Presentations("MonthlyView.ppt").ExportAsFixedFormat "d:\PPTtoPDF.pdf", ppFixedFormatTypePDF
    End Sub

    Monday, June 1, 2015 3:46 PM

Answers

  • worked it out .

    the code could work

    Sub GenerateBooks()

    Dim app As Object

    Set app = CreateObject("PowerPoint.Application")

    app.Visible = True

    Filepath="C:\Users\Administrator\Desktop\MonthlyView.ppt"

     app.Presentations.Open2007  FilePath

     Dim Myppt As PowerPoint.Presentation

     Set Myppt = app.Presentations("MonthlyView.ppt")

    Myppt.ExportAsFixedFormat "d:\MonthlyView.pdf", ppFixedFormatTypePDF

    End Sub

    • Marked as answer by Jenma.Packhum Tuesday, June 2, 2015 6:27 AM
    Tuesday, June 2, 2015 6:27 AM

All replies

  • worked it out .

    the code could work

    Sub GenerateBooks()

    Dim app As Object

    Set app = CreateObject("PowerPoint.Application")

    app.Visible = True

    Filepath="C:\Users\Administrator\Desktop\MonthlyView.ppt"

     app.Presentations.Open2007  FilePath

     Dim Myppt As PowerPoint.Presentation

     Set Myppt = app.Presentations("MonthlyView.ppt")

    Myppt.ExportAsFixedFormat "d:\MonthlyView.pdf", ppFixedFormatTypePDF

    End Sub

    • Marked as answer by Jenma.Packhum Tuesday, June 2, 2015 6:27 AM
    Tuesday, June 2, 2015 6:27 AM
  • This is a great resource for all things pertaining to PPT & VBA.

    http://www.pptfaq.com/index.html


    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Tuesday, June 2, 2015 5:26 PM