![]() |
|
#1
|
|||
|
|||
|
I'm taking a shape from Excel and would like to fill the slide in ppt.
This below is fine, but how can it stretch from the left to the right? Code:
With PPSlide
.Shapes.Paste.Select
With .Shapes(.Shapes.Count)
.LockAspectRatio = msoTrue
.Left = 15
.Top = 100
.Height = 400
End With
|
|
#2
|
|||
|
|||
|
Is this code running in Excel or PowerPoint. and can you include the full code.
|
|
#3
|
|||
|
|||
|
Hi John,
I'm running the code from Excel. This seems to size the shape okay, but most likely a better way to fill the ppt slide. Code:
Sub Chart_Module()
Dim PPPres As Object
Dim PPApp As Object
Dim PPSlide As Object
Dim SlideCount As Long
Dim strFile As String: strFile = "Charts.pptx"
On Error Resume Next
Set PPApp = GetObject(Class:="PowerPoint.Application")
If PPApp Is Nothing Then
Set PPApp = CreateObject(Class:="PowerPoint.Application")
Else
Set PPPres = PPApp.Presentations(strFile)
End If
On Error GoTo 0
If PPPres Is Nothing Then
Set PPPres = PPApp.Presentations.Open(ActiveWorkbook.Path & Application.PathSeparator & strFile)
Else
End If
PPApp.ActiveWindow.ViewType = 1
ActiveSheet.Shapes(3).Copy
SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides.Add(SlideCount + 1, 11)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex
With PPSlide
.Shapes.Paste.Select
With .Shapes(.Shapes.Count)
.LockAspectRatio = msoTrue
.Left = 15
.Top = 100
.Height = 400
End With
With .Shapes(.Shapes.Count)
.LockAspectRatio = msoFalse
.Width = 690
End With
End With
End Sub
|
|
#4
|
|||
|
|||
|
Maybe I'm misunderstanding but maybe use
Code:
With PPSlide
.Shapes.Paste.Select
With .Shapes(.Shapes.Count)
.LockAspectRatio = msoFalse
.Left = 0
.Top = 0
.Width = PPApp.PageSetup.SlideWidth
.Height = PPApp.PageSetup.SlideHeight
End With
End With
|
|
#5
|
|||
|
|||
|
Thanks John. This will work.
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Paste an image in to a set sized shape/container | you | Visio | 1 | 01-08-2020 09:32 PM |
| draw and save a shape that will be used in excel | jerome | Visio | 5 | 05-12-2018 03:41 AM |
how to paste text as shape
|
bsapaka | Excel | 1 | 05-01-2014 06:53 AM |
Excel vba adding field in word table/shape in a header
|
Hdr | Excel | 1 | 02-04-2013 04:40 PM |
| Paste special an Excel range into Outlook as an Excel Worksheet | charlesh3 | Excel Programming | 3 | 02-04-2013 04:33 PM |