vba - 在文本占位符中替换和定位文本
问题描述
该代码替换了我的字体大小。
Sub changeFont()
For Each aSlide In ActivePresentation.Slides
For Each aShape In aSlide.Shapes
If aShape.Type = msoTextBox Then
If aShape.TextFrame.HasText Then
If aShape.TextFrame.TextRange.Font.Name = "Franklin Gothic Demi" Then
If aShape.TextFrame.TextRange.Font.Size = 40 Then
aShape.TextFrame.TextRange.Font.Size = Replace(aShape.TextFrame.TextRange.Font.Size, 40, 25)
End If
End If
End If
End If
Next
Next
End Sub
除此之外,我需要将我的文本框对齐到:
.Top=23
.Left=44
.Height=44
如何定位我的文本支架?
解决方案
尝试以下操作:
Sub changeFont()
Dim aSlide As Slide, aShape As Shape
For Each aSlide In ActivePresentation.Slides
For Each aShape In aSlide.Shapes
If aShape.Type = msoTextBox Then
If aShape.TextFrame.HasText Then
If aShape.TextFrame.TextRange.Font.Name = "Franklin Gothic Demi" Then
If aShape.TextFrame.TextRange.Font.Size = 40 Then
aShape.TextFrame.TextRange.Font.Size = Replace(aShape.TextFrame.TextRange.Font.Size, 40, 25)
aShape.Top = 23
aShape.Left = 44
aShape.Height = 44
End If
End If
End If
End If
Next
Next
End Sub
推荐阅读
- ethereum - 间接合约的函数调用消耗了谁的gas?
- wix - 如何读取作为 MSI 包的一部分嵌入的 json 文件并在 MSI UI 的组合框中填充值?
- image - Android studio 降低图片质量
- c++ - QAudioInput:无法打开音频设备
- javascript - 在另一个数组中满足某个值后如何触发获取数组的下一个元素
- .net-core - 将syncfusion图表导出到指定路径
- python - 无法从 BigQuery 中的工作表查询表
- python - 从 Geotiff 二进制图像中删除单个像素
- c++ - 不同地区之间的问题
- python - 在 Python 中使用 for 循环删除图形标签