Search the Community
Showing results for tags 'ppt'.
-
This is my code to build and format a table in PowerPoint: $oPPTTable = $oSlide.Shapes.AddTable(9,3,10,70).Table With $oPPTTable .ApplyStyle("{5940675A-B579-460E-94D1-54222C63F5DA}",False); No Style, Table Grid... See https://msdn.microsoft.com/en-us/library/office/hh273476(v=office.14).aspx For $x=1 to 9 For $y=1 to 3 .Cell($x,$y).Shape.TextFrame.TextRange.ParagraphFormat.Alignment = 2 .Cell($x,$y).Shape.TextFrame.TextRange.Font.Name= "Arial" .Cell($x,$y).Shape.TextFrame.TextRange.Font.Size= 10 .Cell($x,$y).Shape.TextFrame.VerticalAnchor = 1 Next .Rows($x).Height = 18 Next .Cell(1,1).Merge($oPPTTable.Cell(1,3)) .Cell(1,1).Shape.TextFrame.TextRange.Font.Bold= True .Cell(1,1).Shape.TextFrame.TextRange.Text = "Overall % Comp:" .Cell(1,1).Shape.Fill.ForeColor.RGB = $RGB_Gray .Cell(2,1).Merge($oPPTTable.Cell(2,3)) .Cell(2,1).Shape.TextFrame.TextRange.ParagraphFormat.Alignment = 2 .Cell(2,1).Shape.TextFrame.TextRange.Text= $sOverallPercent .Cell(3,1).Merge($oPPTTable.Cell(3,3)) .Cell(3,1).Shape.TextFrame.TextRange.ParagraphFormat.Alignment = 2 .Cell(3,1).Shape.TextFrame.TextRange.Font.Bold= True .Cell(3,1).Shape.TextFrame.TextRange.Text = "Indicators" .Cell(3,1).Shape.Fill.ForeColor.RGB = $RGB_Gray For $l=1 to 3 If $l = 1 then .Cell(4,$l).Shape.TextFrame.TextRange.Text = "Area" .Cell(4,$l).Shape.TextFrame.TextRange.ParagraphFormat.Alignment = 1 .Cell(4,$l).Shape.TextFrame.MarginLeft = 5 Else .Cell(4,$l).Shape.TextFrame.MarginLeft = 1 EndIf If $l = 2 then .Cell(4,$l).Shape.TextFrame.TextRange.Text = "Pre" FormatCell($sPrevOverall,.Cell(5,$l)) FormatCell($sPrevSchedule,.Cell(6,$l)) FormatCell($sPrevScope,.Cell(7,$l)) FormatCell($sPrevResources,.Cell(8,$l)) FormatCell($sPrevBudget,.Cell(9,$l)) EndIf If $l = 3 then .Cell(4,$l).Shape.TextFrame.TextRange.Text = "Curr" FormatCell($sOverall,.Cell(5,$l)) FormatCell($sSchedule,.Cell(6,$l)) FormatCell($sScope,.Cell(7,$l)) FormatCell($sResources,.Cell(8,$l)) FormatCell($sBudget,.Cell(9,$l)) EndIf .Cell(4,$l).Shape.TextFrame.TextRange.Font.Bold= True .Cell(4,$l).Shape.Fill.ForeColor.RGB = $RGB_Gray .Cell(4,$l).Shape.TextFrame.MarginRight = 1 Next .Columns(1).Width = 50 .Columns(2).Width = 30 .Columns(3).Width = 30 For $l=5 to 9 .Cell($l,1).Shape.TextFrame.MarginLeft = 1 .Cell($l,1).Shape.TextFrame.MarginRight = 1 .Cell($l,1).Shape.TextFrame.TextRange.ParagraphFormat.Alignment = 1 .Cell($l,1).Shape.TextFrame.TextRange.Font.Name= "Arial" .Cell($l,1).Shape.TextFrame.TextRange.Font.Size= 9 Next .Cell(5,1).Shape.TextFrame.TextRange.Text = "Overall" .Cell(6,1).Shape.TextFrame.TextRange.Text = "Overall2" .Cell(7,1).Shape.TextFrame.TextRange.Text = "Overall3" .Cell(8,1).Shape.TextFrame.TextRange.Text = "Overall4" .Cell(9,1).Shape.TextFrame.TextRange.Text = "Overall5" EndWith On this line: .Rows($x).Height = 18 I get an error after about 4 loops through this function that says Bad variable type. It always seems to happen at the same place, but I have a number of these lines elsewhere (to format other tables) and this seems to be the only one causing issues. Anyone have any ideas on how to fix/handle this event?