ganeshpoojary05
Board Regular
- Joined
- Apr 26, 2011
- Messages
- 105
Dear All,
I need a help in positioning my PPT table to extremely left. The below code works fine, however I'm not able to position the range to extremely left in my slide. Request you to provide me the solution. Thanks in advance for your help.
Below is the code for your reference:
Option Explicit
Private PPT As powerpoint.Application
Private PPT_pres As powerpoint.presentation
Private Sub OpenPowerpoint()
Set PPT = New powerpoint.Application
PPT.Visible = True
Set PPT_pres = PPT.Presentations.Open(Filename:="C:\PPT Automation\PMS Presentation.pptx")
'PPT_pres.Slides(5).Select
Call CopyToPowerPoint
End Sub
Private Sub CopyToPowerPoint()
If PPT Is Nothing Then Exit Sub
If PPT_pres Is Nothing Then Exit Sub
Dim rng As Range
Dim mySlide As Object
Dim myShape As Object
Set mySlide = PPT_pres.Slides(5)
'Copy Range from Excel
Set rng = ThisWorkbook.Sheets("Slide 5").Range("B5:F12")
'Copy Excel Range
rng.Copy
'Paste to PowerPoint and position
PPT.WindowState = 2
mySlide.Shapes.PasteSpecial DataType:=8
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
'Set position:
myShape.Left = 5
myShape.Top = 0
myShape.Width = 350
myShape.Height = 150
'Clear The Clipboard
Application.CutCopyMode = False
Application.Wait (Now + TimeValue("00:00:01"))
End Sub
I need a help in positioning my PPT table to extremely left. The below code works fine, however I'm not able to position the range to extremely left in my slide. Request you to provide me the solution. Thanks in advance for your help.
Below is the code for your reference:
Option Explicit
Private PPT As powerpoint.Application
Private PPT_pres As powerpoint.presentation
Private Sub OpenPowerpoint()
Set PPT = New powerpoint.Application
PPT.Visible = True
Set PPT_pres = PPT.Presentations.Open(Filename:="C:\PPT Automation\PMS Presentation.pptx")
'PPT_pres.Slides(5).Select
Call CopyToPowerPoint
End Sub
Private Sub CopyToPowerPoint()
If PPT Is Nothing Then Exit Sub
If PPT_pres Is Nothing Then Exit Sub
Dim rng As Range
Dim mySlide As Object
Dim myShape As Object
Set mySlide = PPT_pres.Slides(5)
'Copy Range from Excel
Set rng = ThisWorkbook.Sheets("Slide 5").Range("B5:F12")
'Copy Excel Range
rng.Copy
'Paste to PowerPoint and position
PPT.WindowState = 2
mySlide.Shapes.PasteSpecial DataType:=8
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
'Set position:
myShape.Left = 5
myShape.Top = 0
myShape.Width = 350
myShape.Height = 150
'Clear The Clipboard
Application.CutCopyMode = False
Application.Wait (Now + TimeValue("00:00:01"))
End Sub