ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Accessing PowerPoint datalabels from excel VBA (https://www.excelbanter.com/excel-programming/282409-accessing-powerpoint-datalabels-excel-vba.html)

KD[_3_]

Accessing PowerPoint datalabels from excel VBA
 
Is there any way I can change font size/ color of my
datalabels in PowerPoint using my Excel vba program?

Many thanks
KD

Joe B.[_3_]

Accessing PowerPoint datalabels from excel VBA
 
Well, I learned something off this site just the other day that helped me with that same kind of thing

'***First, you'll need to go to the tools menu in VBA for excel and choose References. In that huge list find Microsoft PowerPoint 9.0 Object Library and mark it. (Also mark the Microsoft 9.0 Object library if it isn't already)

'***Next, you create a powerpoint object (or however you say it) with the following code in your sub
Dim oPpoint As PowerPoint.Applicatio
On Error Resume Nex
Set oPpoint = GetObject(, "PowerPoint.Application"
On Error Resume Nex

'***If the file is not open, you can use this code to open it
If oPpoint Is Nothing The
Set oPpoint = CreateObject("PowerPoint.Application"
oPpoint.Activat
oPpoint.Visible = Tru
End I
oPpoint.Visible = msoTru
On Error Resume Nex

With oPpoin
.Presentations.Open Filename:="put the path to the file here", ReadOnly:=msoTru

End Wit

'***Next, if you want to access a text box in the presentation, use the following code
With oPpoin
.ActiveWindow.Selection.SlideRange.Shapes("name of the box here").Selec
End Wit
'*and to find the name of the text box, I usually go to power point and tell it to record a macro, where I just select the box and then stop the macro and look at the code it wrote for me

'***Next, to change anything to do with the font, use the following code
With ActiveWindow.Selection.TextRange.Fon
.Name = "Times New Roman
.Size = 2
.Bold = msoTru
.Italic = msoTru
.Underline = msoFals
.Shadow = msoFals
.Emboss = msoFals
.BaselineOffset =
.AutoRotateNumbers = msoFals
.Color.SchemeColor = ppForegroun
End Wit

Hope this help

Joe B.


All times are GMT +1. The time now is 02:39 PM.

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