Villalobos
Active Member
Hello,
I would like to ask some advice regarding font size modification (in Excel 2013 or above), because I do not find the correct way and I am lost.
The below mentioned code copy the Excel range then paste it in powerpoint but unfortunately I cannot change the font size (6 to 8) of myShapeRange object.
Do you have any idea how should it be done?
Thank you in advance any advice!
I would like to ask some advice regarding font size modification (in Excel 2013 or above), because I do not find the correct way and I am lost.
The below mentioned code copy the Excel range then paste it in powerpoint but unfortunately I cannot change the font size (6 to 8) of myShapeRange object.
Do you have any idea how should it be done?
Thank you in advance any advice!
Code:
Option Explicit
Sub CreatePPtPresentation()
Dim ppApp As Object
Dim ppPres As Object
Dim ppSlide As Object
Dim SlideCount As Integer
Dim ppPasteEnhancedMetafile As Variant
Dim myShapeRange As Object
Dim OWidth As Variant
Dim OHeight As Variant
Set ppApp = CreateObject("Powerpoint.Application")
ppApp.Visible = True
Set ppPres = ppApp.Presentations.Add
SlideCount = ppPres.Slides.Count
Set ppSlide = ppPres.Slides.Add(SlideCount + 1, 11)
ppSlide.Shapes(1).TextFrame.TextRange.Text = "Business Gap Deployment " & Sheets(4).Range("B2").Value
With ppSlide.Shapes(1).TextFrame.TextRange.Characters
.Font.Size = 30
.Font.Name = "Arial"
.Font.Color = vbWhite
End With
With ppSlide.Shapes(1)
.Fill.BackColor.RGB = RGB(79, 129, 189)
.Height = 50
End With
Sheets(4).Range("B14:Y28").Copy
Set myShapeRange = ppSlide.Shapes.PasteSpecial(DataType:=ppPasteEnhancedMetafile)
With myShapeRange
.Width = 1000
OWidth = .Width
OHeight = .Height
.Width = 12.5 * 72
.Height = OHeight * (.Width / OWidth)
.Left = 70
.Top = 100
.LockAspectRatio = 0
.Height = 400
.Width = 820
End With
Set ppSlide = Nothing
Set ppPres = Nothing
Set ppApp = Nothing
End Sub