• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Code to export Excel to OVERWRITE an EXISTING PowerPoint

rick_tiger

New Member
Hi all,


I need help! Can anyone tell me how to edit this code so that I can export data I have in Excel to an exisiting PowerPoint file, i.e, I do not want to simply add additional powerpoint slides to an exisiting powerpoint slide package.


Thanks!!

Richard


ub ExportToPPT()

Dim ActFileName As Variant

Dim ScaleFactor As Single


On Error GoTo ErrorHandling

ActFileName = Application.GetOpenFilename("Microsoft PowerPoint-Files (*.ppt), *.ppt")

ScaleFactor = Range("myScaleFactor").Value

Set PP = CreateObject("Powerpoint.Application")

If ActFileName = False Then

PP.Activate

PP.Presentations.Add

Set PP_File = PP.ActivePresentation

Else

PP.Activate

Set PP_File = PP.Presentations.Open(ActFileName)

End If

PP.Visible = True

CopyandPastetoPPT "myDashboard01", Range("myInputStartTitles").Offset(1, 0).Value, ScaleFactor, ScaleFactor

CopyandPastetoPPT "myDashboard02", Range("myInputStartTitles").Offset(2, 0).Value, ScaleFactor, ScaleFactor

CopyandPastetoPPT "myDashboard03", Range("myInputStartTitles").Offset(3, 0).Value, ScaleFactor, ScaleFactor

Set PP_Slide = Nothing

Set PP_File = Nothing

Set PP = Nothing

Worksheets(1).Activate

Exit Sub


ErrorHandling:


Set PP_Slide = Nothing

Set PP_File = Nothing

Set PP = Nothing

MsgBox "Error No.: " & Err.Number & vbNewLine & vbNewLine & "Description: " & Err.Description, vbCritical, "Error"


End Sub
 
Hi, rick_tiger!


First of all welcome to Chandoo's website Excel forums. Thank you for your joining us and glad to have you here.


As a starting point I'd recommend you to read the three first green sticky topics at this forums main page. There you'll find general guidelines about how this site and community operates (introducing yourself, posting files, netiquette rules, and so on).


Among them you're prompted to perform searches within this site before posting, because maybe your question had been answered yet.


Feel free to play with different keywords so as to be led thru a wide variety of articles and posts, and if you don't find anything that solves your problem or guides you towards a solution, you'll always be welcome back here. Tell us what you've done, consider uploading a sample file as recommended, and somebody surely will read your post and help you.


And about your question...


Would you please elaborate a bit more and explain in detail what do you want to do from the Excel file to the Powerpoint file? A manually set output will be helpful for people who read this, so consider uploading samples of both office files (guidelines available at second green sticky posts).


Regards!
 
Back
Top