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.
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.
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.
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:
ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=120, Top:=110, Width:=480, Height:=320, _
FileName:="C:\Documents and Settings\VB-Guru\My Documents\Book1.xls", Link:=msoTrue).Select
With ActiveWindow.Selection.ShapeRange
.Left = 311.625
.Top = 256.875
.Width = 96.75
.Height = 26.25
End With
'ToDo:
'Open the Excel workbook
'Change the active tab and save the workbook
'Close the workbook or close it and the end only?
'Done:
'Refresh the link.
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.