VBA vs VSTO for excellence

I am currently considering several options for copying an excel sheet to a PowerPoint presentation.

  • Using VBA, select an Excel worksheet, copy the range and place it in the newly created PowerPoint slide as an image.
  • I create an excel automatic html sheet, as soon as this html is saved (initially), I create an image from html.
  • Using VSTO, I open Excel by copying each object and pasting it into a new PowerPoint slide using the clipboard (or another copy method).

These operations will often be called by different users - the entire actual operation is performed on the same server.

What are the pros and cons of each approach? Are there any preferred or best optimized methods?

+3
source share
1 answer

Option 1:

Pro:

  • Speed

Contra:

  • The entered data cannot be copied, modified, viewed in excel, etc.

Option 3:

A couple of years ago I wrote a similar VBA- Procedure, which created a presentation of 1000 slides from an Excel sheet. This method was called from Excel and got AFAIR like this (pseudocode):

newSlide = PowerPoint.AddSlide
embeddedSheet = newSlide.Add OLEObject(Excel-Sheet)
embeddedSheet.Range(..., ...) = srcSheet.Range(..., ...)
someFormating(embeddedSheet)
createPieChart(embeddedSheet.Range(..,...))
resize(embeddedSheet)
embeddedSheet.Save
embeddedSheet.Close

Pro / Contra builds on my experience with the above method.

Pro:

  • Sheet embedded in PowerPoint
    • you can change the data and run macros on it.
    • You do not need to save the original Excel sheet.

Contra:

  • Output file larger
  • The process uses a lot of RAM.
  • . AFAIR 1k Slides 10 . OleObject .
+4

Source: https://habr.com/ru/post/1755102/


All Articles