【发布时间】:2016-09-12 14:39:33
【问题描述】:
我编写了一个 for 循环来检查幻灯片上智能艺术中使用的每个字体大小,并输出形状中每个文本块的字体大小。由于某种原因,数组中的第一个条目正确更新(例如,我将一个文本块作为与字体大小连接的字符串)但数组中的任何后续条目仅更新字体大小,但不获取实际块的文本。数组被正确计数(例如 5 个智能艺术形状被正确计数)。
Dim j,e,f as integer
Dim osh as shape
Dim osl as slide
Dim smrtCount as integer
Dim osmrtSize()
dim osmrtSizeMatch()
set osl = activewindow.view.slide
For each
With osh in osl.shapes
If .Type = msoSmartArt Then
smrtCount = smrtCount + .GroupItems.Count
ReDim Preserve osmrtSizeMatch(1 To smrtCount)
ReDim Preserve osmrtSize(1 To smrtCount)
For j = 1 To .GroupItems.Count
e = e + 1
f = f + 1
osmrtSize(e) = .GroupItems(j).TextFrame.TextRange.Runs(j).Font.Size 'store the sizes
osmrtSizeMatch(f) = .GroupItems(j).TextFrame.TextRange.Runs(j).Text '& " = " & .GroupItems(j).TextFrame.TextRange.Runs(j).Font.Size '& vbCrLf
Next j
End If
【问题讨论】:
标签: arrays vba powerpoint