+ Reply to Thread
Results 1 to 3 of 3

Excel to PPT VBA

  1. #1
    Registered User
    Join Date
    01-06-2019
    Location
    N/A
    MS-Off Ver
    2013
    Posts
    1

    Excel to PPT VBA

    Hi, I am trying to export 3 columns of data from excel to Powerpoint. I am using the below code. My excel file opens but I receive a 424 error before anything is exported.

    I have used this code before. Am I missing something? I use the code in a fresh excel spreadsheet and have a PPT open with 3 text boxes.

    Any help would be appreciated!...


    Sub CreateSlides()
    'Open the Excel workbook. doc name.
    Dim OWB As New Excel.Workbook
    Set OWB = Excel.Application.Workbooks.Open("C:doc location.xlsx")
    'Grab the first Worksheet in the Workbook
    Dim WS As Excel.Worksheet
    Set WS = OWB.Worksheets(1)
    'Loop through each used row in Column A
    For i = 1 To WS.Range("A65536").End(xlUp).Row
    'Copy the first slide and paste at the end of the presentation
    ActivePresentation.Slides(1).Copy
    ActivePresentation.Slides.Paste (ActivePresentation.Slides.Count + 1)

    'Change the text of the first text box on the slide.
    ActivePresentation.Slides(ActivePresentation.Slides.Count).Shapes(1).TextFrame.TextRange.Text = WS.Cells(i, 1).Value
    ActivePresentation.Slides(ActivePresentation.Slides.Count).Shapes(2).TextFrame.TextRange.Text = WS.Cells(i, 2).Value
    ActivePresentation.Slides(ActivePresentation.Slides.Count).Shapes(3).TextFrame.TextRange.Text = WS.Cells(i, 3).Value

    Next
    End Sub

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Excel to PPT VBA

    is this code being placed in power point?

    sounds like you placed it into EXCEL
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Excel to PPT VBA

    Please Login or Register  to view this content.
    also CLOSE the wb
    otherwise it remains open in the back ground

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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