|
Open a PowerPoint Presentation from Excel
This free macro for Microsoft Excel allows you to open any PowerPoint presentation from excel. You can change the file extension in the macro to point to any powerpoint file on your computer and then have it open through excel. This is a cool macro which allows you to basically call on powerpoint from the excel inteface. You can attach this macro to a button or a form or checkbox and make it so that when that is clicked, the desired powerpoint presentation opens. This is a useful macro which can be added into any other macro with ease.
You can change the PowerPoint presentation that will open by changing this line of code objPPT.Presentations.Open "C:\test.ppt" so that the directory and file name, including extension, point to the desired file on your computer.
Where to install the macro: Module
Open a PowerPoint Presentation from Excel
Sub Open_PowerPoint_Presentation()
'Opens a PowerPoint Document from Excel
Dim objPPT As Object
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
'Change the directory path and file name to the location
'of your document
objPPT.Presentations.Open "C:\test.ppt"
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
Hi,
I have found some code that copies and pastes an excel sheet into a powerpoint presentation, which is great. But with this code Powerpoint has to be opened manually.
Is there a way to include some code in the macro that opens powerpoint first?
Thanks
I have an excel macro in which I would like to open a powerpoint presentation
based upon a selection made in a drop-down box. The code I have so far is
below, I just don't know how to tell excel how to open the presentation.
Thanks.
Private Sub Business_Plan_Change()
Workbooks.Open Filename:="F:\Reports\" & Business_Plan.Value & ".ppt"
End Sub
I am running a macro from excel that copies tables and charts into a PowerPoint template. If the template file is already open I'd like to set it as the presentation I'm going to work with and if it is not open I want to open it. I have tried to adapt a number of approaches that I found from other places but I could not get anything to work. Here are a few of the thing I tried:
Code:
Dim pptPrs As PowerPoint.Presentation
Dim pptApp As PowerPoint.Application
Dim opnFlg As Boolean
opnFlg = False
For Each pptPrs In PowerPoint.Presentations
If pptPrs.Name = "template.pptx" Then
opnFlg = True
Set pptApp = GetObject(, objPrs)
pptApp.Visible = True
End If
Next
If opnFlg = False Then
Set pptApp = New PowerPoint.Application
pptApp.Visible = True
pptApp.Presentations.Open Filename:="C:\test\template.pptx"
End If
Here is a function someone wrote and I modified somewhat that only does the checking to see if the presentation is open... however this also I could not get to work:
Code:
Function IsPresentationOpen(strPresName As String) As Boolean
Dim oPresObject As PowerPoint.Presentation
Dim boolIsFullPath As Boolean
' Check to see whether the full path was passed.
If (InStr(1, strPresName, ":\")) = 0 Then
boolIsFullPath = False
Else
boolIsFullPath = True
End If
' Loop through the open presentations.
Set oPresObject = CreateObject("PowerPoint.Presentation")
For Each oPresObject In PowerPoint.Presentations
If boolIsFullPath = True Then
' Check for a match.
If (StrComp(oPresObject.FullName, strPresName, vbTextCompare) = 0) Then
IsPresentationOpen = True
Exit Function
End If
Else
' Check for a match.
If (StrComp(oPresObject.Name, strPresName, vbTextCompare) = 0) Then
IsPresentationOpen = True
Exit Function
End If
End If
Next oPresObject
' No match found.
IsPresentationOpen = False
End Function
Any help is much appreciated. Thanks!
I have a powerpoint slide with several links to an excel spreadsheet. It is taking too long to update. In hopes of speeding up the update process, I have pasted the slide into the excel file. Is there a way to update the powerpoint automatically? Now when I click on the slide it asks if I want to update but I'd like this to happen automatically. Thanks
Ok, I've got my super-whizzy Powerpoint presentation up and running and several of the slides feature Excel data and charts flying in and out.
The source Excel files live in a directory called (originally) Excel source. If next month I change the data in the source files and then re-run the PowerPoint presentation, will the updated data appear?
All replies appreciated.
I have a project that requires me to paste individual sheets from excel to powerpoint. The wrinkle in this project is that each sheet could contain either data (rows & columns) or excel charts. The good thing is each sheet has a defined print area. Is there any code that would paste each sheet based on the print area into an existing powerpoint template? All help is greatly appreciated.
Hi All,
Can anybody help me out by telling me hw can i transfer data from a range in an excel sheet to a powerpoint presentation??????
Thanks to all in advance!!!!!!
Is there a way to convert an excel wookbook to view as a power point presention without, having to copy and past pieces into slides? Looking for a short cut for a mundane process
Thanks
All,
I have a powerpoint presentation with an embedded excel workbook in it (with lots of worksheets). Is there a quick way I can extract the workbook as a separate excel workbook file? Thanks.
- Matt
|
|