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

Updated July 20, 2017

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.

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Jaime Avelar is a professional writer whose programming articles appear on various websites. He has been a software programmer since 2000. Avelar holds a Master of Science in information systems from the University of Texas at Arlington.