+ Reply to Thread
Results 1 to 2 of 2

Paste multiple cell values into the same powerpoint slide

  1. #1
    Registered User
    Join Date
    05-14-2019
    Location
    Philadelphia
    MS-Off Ver
    Office 365
    Posts
    1

    Arrow Paste multiple cell values into the same powerpoint slide

    I have an excel document with rows of data in it. My goal is to be able to select a certain cell with text in it by marking it “Strength (#)” and then have that value paste into an already formatted powerpoint. There would be around 9 different markings I would have to paste, so my thought is do a for loop based on if the cell is marked. The code sets the variable and pastes the range, but it will not paste multiple items. It will keep pasting the cells on top of one another so the result is that my powerpoint will only contain what I have marked as “Strength 2”

    [VBA]

    Dim Strength1, Strength2 As Range
    Dim mySlide, myShape, PowerPointApp, myPresentation As Object

    Application.ScreenUpdating = False

    Set PowerPointApp = GetObject(class:="Powerpoint.Application")
    If PowerPointApp Is Nothing Then Set PowerPointApp = CreateObject(class:="Powerpoint.Application")
    Set myPresentation = PowerPointApp.Presentations.Open("C:/Desktop/test.pptx")

    Set mySlide = myPresentation.Slides(1)

    For b = 29 To 85

    a = 50
    Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
    myShape.Left = 25
    myShape.Top = a
    If ThisWorkbook.Worksheets("Comparisons").Cells(b, 8) = "Strength1" Then
    Set Strength = ThisWorkbook.Worksheets("Comparisons").Cells(b, 2)
    ElseIf ThisWorkbook.Worksheets("Comparisons").Cells(b, 8) = "Strength2" Then
    Set Strength = ThisWorkbook.Worksheets("Comparisons").Cells(b, 2)
    End If

    With myShape
    With .TextFrame
    .TextRange.Text = Strength
    .AutoSize = 1
    With .TextRange.ParagraphFormat
    .Alignment = ppAlignLeft
    End With
    With .TextRange.Font
    .Size = 26
    .Name = "Arial"
    .Color.RGB = RGB(242, 105, 36)
    End With
    End With
    End With
    Set myShape = mySlide.Shapes(Count + 1)
    a = a + 50
    Next b

    PowerPointApp.Visible = True
    PowerPointApp.Activate

    End Sub
    [/VBA]

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,640

    Re: Paste multiple cell values into the same powerpoint slide

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    We usually do it ourselves for new members but I am unable to edit your post ( forum glitch). Please add the tags as requested Please read forum rules. Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Paste graph from excel to a specific position in powerpoint slide
    By yattick in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2017, 11:26 AM
  2. Problem with VBA Code - Paste directly to PowerPoint Slide
    By felipeBRF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-07-2017, 12:00 PM
  3. [SOLVED] Paste Range to duplicated Powerpoint slide not working the way i'd hoped. HELP!!!!!
    By Jschroeder71 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2016, 07:59 AM
  4. [SOLVED] How to copy and paste 4 excel graphs into a single PowerPoint slide evenly?
    By Mirisage in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 03-07-2015, 12:47 AM
  5. Copy and paste some charts from excel into specific slide on a powerpoint template
    By ones4rus in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2013, 03:00 AM
  6. macro to copy paste excel name range to powerpoint new slide
    By koi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-17-2013, 04:55 PM
  7. Paste multiple ranges by Inputbox and paste it on one slide in powerpoint
    By irfanparbatani in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2012, 10:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1