vba - 使用 VBA 在 Powerpoint 中按字母顺序对部分进行排序
问题描述
我有一个包含许多部分的大 PowerPoint 文件,并且我不断添加一些部分。
我正在寻找一种按字母顺序对我的部分进行排序的方法。
我确信使用 VBA 是可行的,但我的知识有限,我找不到类似的代码来适应。
非常感谢你的帮助!
解决方案
这是基于经典的数组排序逻辑 - 但适用于部分。
如果您有很多部分,不知道这是否是性能问题。
Sub sortSections()
Dim sp As SectionProperties
Set sp = ActivePresentation.SectionProperties
Dim cntSections As Long
cntSections = sp.Count
Dim i As Long, j As Long
For i = 1 To cntSections - 1
For j = i + 1 To cntSections
If UCase(sp.Name(i)) > UCase(sp.Name(j)) Then
sp.Move j, i
End If
Next
Next
End Sub
推荐阅读
- c# - 打开窗口的问题 - 表格
- r - R 当 y 值第一次等于 0 时打印 x 值
- python - Python 类型上的“模板化”
- asp.net - IIS 一次只处理一个请求
- react-native - TextInput 在 react-native 中隐藏在键盘后面
- linux - Linux Mint 上的各种 Docker 容器路径因权限错误而开始失败
- java - 如何使可运行的 jar 指向不同的 JRE,Maven?
- xamarin.forms - 在发布版本中保留共享项目中的所有类
- c++11 - C++11:在尾随返回类型中正确扩展模板参数包
- angular - 在 Angular 9 中记录整个桌面