How to Automatically Copy From Excel to PowerPoint Using a VBA Macro

Written by jaime avelar | 13/05/2017
How to Automatically Copy From Excel to PowerPoint Using a VBA Macro
Add shapes and text to a PowerPoint slide using VBA. (Hemera Technologies/ Images)

If you ever wanted to expedite the transfer of data from a Microsoft Excel workbook to your Microsoft PowerPoint presentation, then using a macro and Visual Basic for Applications is the way to go. VBA is a computer programming language employed in Microsoft Office applications to automate processes such as copying data from Excel. A macro allows you to save a set of instructions that you can execute over and over again with a click of a button.

Launch Excel, type "Alan" in "A1," "Daniel" in "A2," "Kitzia" in "A3," "Oscar" in "A4" and "Yarexli" in "A5." Press "CTRL" and "S" to save the workbook in "C:\" as "ExcelFile.xlsx." Close Excel.

Launch PowerPoint, click the "Developer" tab and click "Macros" to launch the Macro dialogue window. Type "copyFromExcel" below Macro Name and click the "Create" button. Click the "Tools" menu and click "References" to launch the References dialogue window. Scroll down and check the box next to "Microsoft Excel Object Library" and click "OK."

Copy and paste the following to create the variables you will use to copy the data from Excel:

Dim sourceXL As Excel.Application

Set values to the object variables:

Read the data in the Excel file and store it in a String array:

Add the data from the String array to a new slide in your current presentation:

Close the workbook:

Switch to the PowerPoint window and click "Macros." Click "Run" to run the "copyFromExcel" macro and add a new slide with the data copied from the Excel file you created in Step 1.

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.