VBA Programming in Excel with Powerpoint

M

MVM

I am trying to copy 10X4 cells from excel and paste it in powerpoint slide.
It opens the pp, add a new slide (pplayoutTitleOnly) and pastes it there.
Now I need to position the table and change font, size etc.
if I record the macro this is what I get.
ActiveWindow.Selection.TextRange.Font.Size = 18
Since excel and pp are open and the code is in excel editor, i think it is
confused with activewindow.
How do I change the font and other format.

any help is appreciated
Thanks
MVM
 
M

MVM

1> By "it", I assume you mean your code that's running in Excel?
Yes you are right
2> > ActiveWindow.Selection.TextRange.Font.Size = 18
You record that where ... in PowerPoint or Excel?

yes, this is recorded in PowerPoint
3 code
________________________________________
.....
Set objPP = GetObject("", "PowerPoint.Application")
objPP.Visible = True
Set pp = objPP.Presentations.Open("C:\BSC - 4th Qtr Service Awards.ppt")
i = 1
While i < myR.Rows.Count
Set moveR = myR.Range(myR(i, 1), myR(i + 9, 1))
Set moveR = myR.Range(moveR, moveR.End(xlToRight))
With pp.Slides
.Add Index:=.Count + 1, Layout:=ppLayoutTitleOnly
moveR.Copy
pp.Slides(.Count).Shapes.Paste
pp.Slides(.Count).Shapes(pp.Slides(.Count).Shapes.Count).Name = "myTable"
With pp.Slides(.Count).Shapes("myTable")
.Top = 125
.Left = 50
End With
objPP.ActiveWindow.ViewType = ppViewNormal

' ActiveWindow.Selection.TextRange.Font.Name = "Times New Roman"
With objPP.ActiveWindow.Selection.TextRange.Font
.Size = 16
.Bold = msoTrue
.Name = "Times New Roman"
End With
.....

This changes the font of title on first slide, not on the just added one.

Thanks
MVM
 
B

Brian Reilly, MVP

Also
With pp.Slides
.Add Index:=.Count + 1, Layout:=ppLayoutTitleOnly
moveR.Copy
will not copy the range since you are issuing the command to PPT. get
the moveR.copy out of the With pp.slides statement

Brian Reilly, MVP
 
Top