Question

I am trying to write an add-in for Powerpoint, the user should be able to select cells in an Excel worksheet and then go to the Powerpoint slide he would like to paste that table in, after starting the Add-in, a macro should create a table and copy cell by cell. Afterwards the macro will format the PowerPoint table according to our formatting guidelines. I am running into some issues now:

1) How can I go through the cells within a selected range in Excel, I tried to loop through the cells within the selected range, but neither this nor counting the rows/columns with in the selected range works (I am rather unfamiliar with Excel VBA)

2) What is the best way to copy data from Excel to Powerpoint? I have seen some suggestions that use a string array, that reads in all the data first; some users re-use one variable to copy the data and some do it directly from a XL to a PPT reference, what are the advantages of the different approaches?

Thanks a lot s

Was it helpful?

Solution

For your first question, here is a snippet of code that works (yet, it depends on what you intend to do):

Dim C As Range
For Each C In Range("A1:A100")
    'do stuff
Next C

For your second point, it depends on the results you expect :

  • a PowerPoint formatted array
  • an Excel Object embedded into PowerPoint
  • copy-paste the values inside the slide content

Once you have chosen, it's easy to find ressources on the web to do what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top