我有更改字体的代码,但它不能正常工作:(我想循环所有演示文稿并通过InputBox更改字体大小和样式。任何人都可以帮助我吗?非常感谢!
Sub FormatTextBoxes()
Dim intSlide As Integer
Dim strNotes As String
Dim nts As TextRange
Dim strFont, intSize
intSize = InputBox("Please enter font size", "fontsize", "12")
strFont = InputBox("Please enter font", "font type", "Calibri")
With ActivePresentation
For intSlide = 1 To .Slides.Count
Set nts = ActivePresentation.Slides(intSlide).NotesPage. _
Shapes.Placeholders(2).TextFrame.TextRange
With nts
If intSize = "" Then intSize = 12
.Paragraphs.Font.Size = intSize
.Paragraphs.Font.Name = strFont
End With
Next intSlide
End With
MsgBox ("FormatNotes uitgevoerd")
End Sub
答案 0 :(得分:1)
这将更改所有幻灯片上所有幻灯片对象的字体大小:
Option Explicit
' *************************************************************
' Purpose : PowerPoint macro to change font size for all shapes
' on all slides across the active presentation
' Author : Jamie Garroch of http://YOUpresent.co.uk/
' Inputs : None
' Outputs : None
' *************************************************************
Sub ChangeFontSizeForSlideShapes()
Dim oSld As Slide
Dim oShp As Shape, oGrpItem As Shape
For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.Type = msoGroup Then
For Each oGrpItem In oShp.GroupItems
If oGrpItem.HasTextFrame Then
oGrpItem.TextFrame.TextRange.Font.Size = 12
End If
Next ' oGrpItem
Else
If oShp.HasTextFrame Then
oShp.TextFrame.TextRange.Font.Size = 12
End If
End If
Next ' oShp
Next ' oSld
End Sub