Consulting

Results 1 to 20 of 71

Thread: Copy each excel worksheets and paste in each indivual slides

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location

    Copy each excel worksheets and paste in each indivual slides

    Here is the link I ask the question the first time.

    http://vbaexpress.com/forum/showthre...9284#post59284


    Can this code could be modified to work in power point?

    Option Explicit 
     
    Sub CombineFiles() 
     
        Dim Path            As String 
        Dim FileName        As String 
        Dim Wkb             As Workbook 
        Dim WS              As Worksheet 
     
        Application.EnableEvents = False 
        Application.ScreenUpdating = False 
        Path = "S:\Conference\Presentaions" 'Change as needed
        FileName = Dir(Path & "\*.xls", vbNormal) 
        Do Until FileName = "" 
            Set Wkb = Workbooks.Open(FileName:=Path & "\" & FileName) 
            For Each WS In Wkb.Worksheets 
                WS.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count) 
            Next WS 
            Wkb.Close False 
            FileName = Dir() 
        Loop 
        Application.EnableEvents = True 
        Application.ScreenUpdating = True 
     
    End Sub
    The reason is right now I'm showing all these worksheet tabs on a projector using excel at the production meeting. Can I run a macro on Excel or power point that it will copy each worksheet that are group objects and paste it in each individual slide in power point?

    I found this code but it does not do exactly how I would like it.

     
    Sub CopyXLChart()
    Dim xlApp As Object
    Dim xlWrkBook As Object
    Set xlApp = CreateObject("Excel.Application")
    Set xlWrkBook = lApp.Workbooks.Open"S:\Conference\PresentaionsChart as of 10-19-2005.xls")
     
    ' Copy the 1st chart object on the 1st worksheet
    ' you can use Cut instead.
    xlWrkBook.Worksheets(1).GroupObjects(1).Copy
     
    'Pastes the contents of the Clipboard into the active view.
    'Attempting to paste an object into a view that won't accept
    'will cause an error. Look up the help file for more info.
     
    ActiveWindow.View.Paste
     
    ' Close the open workbook.
    ' I have set the flag to FALSE so that in case I make any changes
    ' to the XL file I don't want to be prompted with the Save Dialog.
    ' No changes are saved
    xlWrkBook.Close False
    xlApp.Quit
     
    Set xlApp = Nothing
    Set xlWrkBook = Nothing
    End Sub
    Last edited by Shazam; 03-01-2006 at 08:37 PM.

Posting Permissions

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