Display image from excel into powerpoint

mmol_75

New Member
Joined
Mar 6, 2009
Messages
21
Is it possible to create a macro from excel to pull an object or image and link into a powerpoint slide. Im trying to create a way for people to send messages from an excel file to a Plasma TV screen that is linked via a network, and broadcast messages without having to stop the powerpoint and manually paste into the slide...
Or if there is any other way within microsoft office suite to link an image and send to powerpoint via a macro...
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Yes it is possible, you asked for "objects or images" in your question, so for example, if you have chart sheets (not charts embeded on a worksheet in this example, but charts on a chart sheet) in your workbook and you want to transfer each one to its own slide in a PowerPoint file, then do this:

Open PowerPoint. Not any file in PowerPoint, just PowerPoint.

Go back to your workbook, press Alt+F11, and from the menu, click Tools > References and establish a reference (by clicking in the box to put a checkmark next to) "Microsoft PowerPoint 11.0 Object Library" where 11.0 will depend on your version of Excel, 11 = version 2003.

Click OK.

Click Insert > Module and paste in the below macro, then press Alt+Q to return to the worksheet.

I stuck a bunch of comments in the code to help explain the process, which tested no problem for me.

If you need objects other than chart sheets (which was only a wild guess on my part to provide an example, as you did not say what "object" you had in mind) then just modify the code accordingly depending on the object you really are dealing with.

Code:
Sub CopyPowerPointTest()
'Open PowerPoint but do not open the destination file
Dim oPowerPoint As New PowerPoint.Application
Dim appPPT As PowerPoint.Application
Dim pptPres As Presentation
Dim pptSlide As Slide
Dim ch As Chart
Dim aChtObj As ChartObject
Dim SlideCount As Long
 
'Create a new Presentation and add title slide
Set pptPres = oPowerPoint.Presentations.Add
 
With pptPres.Slides
    Set pptSlide = .Add(.Count + 1, ppLayoutTitleOnly)
    pptSlide.Shapes.Title.TextFrame.TextRange.Text = "mmol_75's chart copy test"
pptPres.SaveCopyAs (ThisWorkbook.Path & "\mmol_75Test.ppt")
 
'Reference existing instance of PowerPoint
Set appPPT = GetObject(, "Powerpoint.Application.11")
 
'Reference active presentation
Set pptPres = appPPT.ActivePresentation
appPPT.ActiveWindow.ViewType = ppViewSlide
 
'Place each chart sheet in a slide
For Each ch In ThisWorkbook.Charts
    ch.CopyPicture Appearance:=xlScreen, Format:=xlPicture, Size:=xlScreen
     'Add a new slide
    SlideCount = pptPres.Slides.Count
    Set pptSlide = pptPres.Slides.Add(SlideCount + 1, ppLayoutBlank)
    appPPT.ActiveWindow.View.GotoSlide pptSlide.SlideIndex
        'paste and select the chart picture
        pptSlide.Shapes.Paste.Select
        'align the chart
        appPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, msoTrue
        appPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, msoTrue
 
 
appPPT.ActiveWindow.Selection.SlideRange.Shapes.AddLabel(msoTextOrientationHorizontal, 300, 20, 500, 50).Select
appPPT.ActiveWindow.Selection.ShapeRange.TextFrame.WordWrap = msoFalse
With appPPT.ActiveWindow.Selection.ShapeRange.TextFrame.TextRange
.Characters(Start:=1, Length:=0).Select
        .Text = "This is " & ch.Name
        With .Font
            .Name = "Arial"
            .Size = 12
            .Bold = msoTrue
            .AutoRotateNumbers = msoFalse
            .Color.SchemeColor = ppForeground
        End With
    End With
Next ch
End With
 
'Clean up
    Set oPowerPoint = Nothing
    Set pptSlide = Nothing
    Set pptPres = Nothing
    Set appPPT = Nothing
End Sub
 
Upvote 0
Tom, Thank You for the code. its pretty impressive...

Hope you dont mind helping me with another detail to my question.....

The way i have my files set up are as follows:
I have a total of 3 files (2 excel files and 1 running powerpoint file).

File 1: this file allows people to insert their message or image. (can be opened or closed by the user with no interrruption to file 3)
File 2: this file is always open, and is basically a link file that updates links from Excel file 1.
File 3: Powerpoint file that is in presentation mode and always open. This files gets it data from File 2. (The reason i created file 2, is becasue its always open and doesnt interrupt File 3 when updating links.

What im looking for is a macro between Files 1 and 2, where the user can input images or messages into the charts tab in File 1, then when they hit Save, it sends the image or message to File 2. File 2 then grabs the image or message from File 1, and inserts it into its charts sheet. Then, File 3 grabs the image from File 2 and presents it on the powerpoint slide show. I dont want to open new powerpoint presentations, but rather would like to assign a certain powerpoint slide within File 3 where the image or message will show up, based on File 1 inputs and File 2 updates.

If you can figure that out, you have solved my problem. Ive been able to acheive this with basic data and linked charts, but not with images...

I would be very grateful if you could lead me in the right direction...
 
Upvote 0

Forum statistics

Threads
1,222,405
Messages
6,165,864
Members
451,988
Latest member
boo203

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top