【发布时间】:2018-08-30 20:48:09
【问题描述】:
无法处理我的代码中的异常。我已经编写了下面的代码来将 powerpoint 表的内容传输到数组中,但它一直抛出一个异常说
幻灯片(未知成员):请求无效。幻灯片 ID 无效。
我输入了错误句柄来尝试跳过它,因为在出现错误的情况下条目是否留空对我来说并不重要。但是,我无法让它通过这个错误! (接下来我不能使用简历)。任何帮助都会很棒。
'loop through table and store values to a temporary array in order to sort it
'NOTE that the Table starts at (1,1) and the storage array starts at (0,0) (see "j")
For j = 1 To oTbl.Rows.Count
'First check that the string being stored is a hyperlink and not an empty cell
If Not (oTbl.Cell(j, 2).Shape.TextFrame.TextRange.ActionSettings(ppMouseClick).Hyperlink.SubAddress) = "" Then
'create a temp variable to operate on the hyperlink address in each row in the table
subAd = oTbl.Cell(j, 2).Shape.TextFrame.TextRange.ActionSettings(ppMouseClick).Hyperlink.SubAddress
'Find the CURRENT slideIndex and store in column 1 (for sorting)
'write error condition for if the slideID points to a slide that has been deleted
On Error GoTo errCatch
pLinkNumber = Left(subAd, InStr(subAd, ",") - 1)
aStorage(j - 1, 1) = ActivePresentation.slideS.FindBySlideID(CLng(pLinkNumber)).SlideIndex
'store the CURRENT hyperlink address as column 0 (after defining colum 1 for error handling reasons)
aStorage(j - 1, 0) = subAd
Else
errCatch:
End If
Next j
【问题讨论】:
标签: vba error-handling runtime-error powerpoint