Consulting

Results 1 to 4 of 4

Thread: Export to PP

  1. #1

    Export to PP

    Hi,

    Today I知 trying to create a function that will export whatever I selected to powerpoint and I found a code on the web that works really well because it allows me to edit the data in powerpoint however the flaw is that is not copying the charts on the selection ,I知 really novice on exporting commands so I値l really appreciate your help .


    [VBA]
    'Dim pptApp As PowerPoint.Application
    Dim pptApp As Object
    'Dim pptPres As PowerPoint.Presentation
    Dim pptPres As Object
    Dim myRange As Excel.Range
    Set myRange = Selection
    'Worksheets("US").Range ("F1:AB31")
    Set pptApp = GetObject(Class:="PowerPoint.Application")
    Set pptPres = pptApp.ActivePresentation

    ' Dim ppPrez As Object
    '
    'Set ppPrez = pptApp.Presentations.Add

    myRange.Copy
    pptPres.Windows(1).Activate
    pptPres.Windows(1).View.GotoSlide 3
    pptApp.CommandBars.ExecuteMso ("PasteSourceFormatting")
    End Sub
    [/VBA]

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    This suffices:

    [VBA]
    Sub M_snb()
    Sheets(1).Range("A1:C10").Copy
    GetObject(, "Powerpoint.application").ActivePresentation.Slides(3).Shapes(1).TextFrame. TextRange.Paste
    End Sub
    [/VBA]

  3. #3
    I might be doing something wrong but the code looks like is losing the table format if it痴 text and is not copying the graph, is there something that I might be doing wrong ?

    [VBA]
    Sheets("US").Range("AL36:BN65").Copy
    GetObject(, "Powerpoint.application").ActivePresentation.Slides(3).Shapes(1).TextFrame. TextRange.Paste
    [/VBA]

  4. #4
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    you could try to use pastespecial instead of paste.
    You can record a macro in PP to find out.

Posting Permissions

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