ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel to Powerpoint - Text Box Properties (https://www.excelbanter.com/excel-programming/402732-excel-powerpoint-text-box-properties.html)

AussieDave

Excel to Powerpoint - Text Box Properties
 
When copying a text box from Excel to Powerpoint, the source data
(Verdana 10pt) becomes Times New Roman 24pt in the destination! Any
ideas as to how this can be remedied within my macro?
Thanks in advance, Dave

Mark Ivey

Excel to Powerpoint - Text Box Properties
 
Sub TextBox2PPT()

Dim PPApp As Object
Dim PPPres As Object
Dim PPSlide As Object
Dim myFontName As Variant
Dim myFontSize As Long

With Selection.Font
myFontName = .Name
myFontSize = .Size
End With

Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = 9
Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.Selection. _
SlideRange.SlideIndex)

Selection.Copy

PPSlide.Shapes.Paste.Select

PPApp.ActiveWindow.Selection.ShapeRange.TextFrame. TextRange. _
Font.Size = myFontSize
With PPApp.ActiveWindow.Selection.ShapeRange.TextFrame. _
TextRange.Font
.NameAscii = myFontName
.NameOther = myFontName
.NameFarEast = myFontName
End With

Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com