Results 1 to 4 of 4

Thread: Help in linking multiple worksheets from a single Excel file to powepoint.

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Posts
    52

    Question Help in linking multiple worksheets from a single Excel file to powepoint.

    Guys,

    I am writing a macro in powerpoint to link a excel sheet using AddOLEObject..My code is..
    ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=120#, Top:=110#, Width:=480#, Height:=320#, FileName:="C:testexcel.xls", Link:=msoTrue).Select

    This works fine for me..

    But I have multiple worksheet in the "testexcel.xls" file and I want to link all the worksheets into powerpoint slides one by one.
    Any idea of how to do this ?
    Note: Even if it can be accomplished without writing a macro also appreciated(design time).

    Thanks for your help..
    Kandan.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Help in linking multiple worksheets from a single Excel file to powepoint.

    When you do an AddOLEObject it takes the first sheet as turns it into an image.
    There is no way to navigate to the other sheets. The only thing you can do is have one sheet per workbook
    and add them indivdually.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Member
    Join Date
    Aug 1999
    Posts
    52

    Re: Help in linking multiple worksheets from a single Excel file to powepoint.

    Thanks for the information..
    btw, Is there any other way other than AddOleObject where I can link multiple sheets in a excel sheet.

    Thanks again,
    Kandan.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Help in linking multiple worksheets from a single Excel file to powepoint.

    Ok, its a bit messy but for now this should work.
    VB Code:
    1. ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=120, Top:=110, Width:=480, Height:=320, _
    2.     FileName:="C:\Documents and Settings\VB-Guru\My Documents\Book1.xls", Link:=msoTrue).Select
    3.     With ActiveWindow.Selection.ShapeRange
    4.         .Left = 311.625
    5.         .Top = 256.875
    6.         .Width = 96.75
    7.         .Height = 26.25
    8.     End With
    9.     'ToDo:
    10.     'Open the Excel workbook
    11.     'Change the active tab and save the workbook
    12.     'Close the workbook or close it and the end only?
    13.    
    14.     'Done:
    15.     'Refresh the link.
    16.     ActiveWindow.Selection.ShapeRange.OLEFormat.DoVerb Index:=1
    Seems that when you save the workbook with a diffeent sheet as the active tab, when you insert
    the workbook to PP it will take a snaposhot of the active sheet only. So my thinking was if you can switch the active
    sheet and refresh the link between slides.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width