0

I'm pretty much done with my project of automating copy-pasting a bunch of ranges from Excel to a Powerpoint presentation. Now a co-worker remarked that I could save the relevant ranges as jpeg, pdf or whatever else and only then export it to Powerpoint.

This got me thinking. Is there an advantage of doing it my co-worker's way? The only one I (an inexperienced user) can think of is that I would have the data I exported on my hard drive as separate files. Are there any other advantages or even disadvantages to this method?

Alex
  • 515
  • 5
  • 19
  • 1
    If what you have works fine, then a separate export step just seems to add complexity. What are the specific advantages of having the range images as separate files? Do you need to use them elsewhere? – Tim Williams Apr 15 '19 at 17:06
  • 1
    There's no need to save each range/image separately. You can just use the same path (in a loop). As a practical matter, you may not always be able to assume that your program has write access, and of course it's nice not to clutter up a user's hard drive with useless image files so you should always attempt to clean up/remove them afterwards. So that's a few points *against* saving them to disk. – David Zemens Apr 15 '19 at 18:49
  • 1
    From experience, people use the Export method because it's more explicit and maybe easier to control when working between different application threads where copy/paste may be prone to some tricky error conditions. You might also consider looking at the various `ExecuteMSO` options, for the "galaxy brain" version of copy/paste. – David Zemens Apr 15 '19 at 18:53

2 Answers2

1

The main advantage of saving it through an image/pdf is the staticness of the output file. Not only on the values, but also on the format, across all users, despite the differences of versions/preferences/fonts... [Side note: I do really prefer .pdf or even .emf as these formats are vectorial, so they do not get pixelated if you are zooming in]

I would suggest using a temporary file for that. Remember to kill the file after adding it to the PowerPoint.

Here is a pseudo-code to give you the general idea:

Get the Temp file name [and file path]
Export/Print your range/tables (in whatever format you want) using the temporary file name
Import that file as an image in PowerPoint (remember to set LinkToFile:=False)
Delete the temporary file
CharlesPL
  • 331
  • 1
  • 10
0

No matters if you do the 1 or 2 way ,

About eficiency i think the Pasting directly in powerpoint is more useful and powerful bcoz is less 1 step (saving in a Directory and them put it on ppt)

If u need this informations (jpgs /pdfs) or just want to have them saved so u should use your friend's tip , but if u dont need it , just keep your way of doing the copy and paste

Ronan Vico
  • 585
  • 3
  • 9