Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Linking with powerpoing using VBA

Recording a macro in PowerPoint gives this for sizing and positioning:

ActiveWindow.Selection.SlideRange.Shapes("AutoShap e 4").Select
With ActiveWindow.Selection.ShapeRange
.ScaleWidth 0.74, msoFalse, msoScaleFromTopLeft
.ScaleHeight 0.79, msoFalse, msoScaleFromBottomRight
End With
With ActiveWindow.Selection.ShapeRange
.IncrementLeft 48#
.IncrementTop -6#
End With

You should be able to do that from Excel by referencing the PPT app,
something like "PPApp.Activewindow.Selection...". A little experimenting
will get you there!



"Emma" wrote:

Hi

I've worked it out :)

Thank you very much for all your help Eric. Now i just need to work out how
to resize the picture :)

Set PPSlide = PPPres.Slides(2)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex

With PPSlide

' Paste the range
PPSlide.Shapes.Paste.Select

' Position pasted chart

PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True

End With
"EricG" wrote:

This version opens an existing PowerPoint file instead of creating a new one,
then adds some slides and selects the second slide. Watch for line wrap in
the code below!

Sub Control_PPT()
Dim PPTApp As PowerPoint.Application
Dim PPres As PowerPoint.Presentation
Dim theSlide As PowerPoint.Slide
Dim PPTFile As Variant
'
PPTFile = Application.GetOpenFilename("PowerPoint Files (*.ppt*),
*.ppt*", , "Select a PowerPoint File to Open", , False)
If (PPTFile = False) Then Exit Sub
'
Set PPTApp = New PowerPoint.Application
PPTApp.Visible = msoTrue
Set PPres = PPTApp.Presentations.Open(PPTFile, msoFalse, , msoTrue)
PPres.Slides.Add Index:=PPres.Slides.Count + 1, Layout:=ppLayoutBlank
PPres.Slides.Add Index:=PPres.Slides.Count + 1, Layout:=ppLayoutBlank
PPres.Slides.Add Index:=PPres.Slides.Count + 1, Layout:=ppLayoutBlank
'
Set theSlide = PPres.Slides(2)
theSlide.Select
'
' Do other stuff here...
'
' Unload the PowerPoint stuff
'
Set theSlide = Nothing
Set PPres = Nothing
Set PPTApp = Nothing
'
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object linking/Worsksheet linking/etc... MikeH Excel Discussion (Misc queries) 0 June 15th 09 05:26 PM
An error msg in Excel 2007 regarding Linking but no linking in fil Jugglertwo Excel Discussion (Misc queries) 0 September 12th 08 02:08 AM
Linking amy Excel Discussion (Misc queries) 4 May 11th 08 11:27 PM
Help with Linking mkerstei Excel Discussion (Misc queries) 1 August 3rd 05 05:46 PM
Need to create report in Powerpoing from Excel data sgupta17[_2_] Excel Programming 1 June 11th 04 12:07 AM


All times are GMT +1. The time now is 09:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"