宏在WORD中工作但在Excel中出现错误" Object Required"

时间:2017-11-24 09:51:11

标签: excel vba excel-vba ms-word word-vba

我有代码

Dim obj As Shape
i = 1

For Each obj In ActiveDocument.Shapes
    ActiveDocument.Shapes.Range(i).Select

    Debug.Print Selection.ShapeRange.Name
    Debug.Print Selection.ShapeRange(1).OLEFormat.iconlabel

    If Selection.ShapeRange(1).OLEFormat.iconlabel = "ASF_DebtorID" Then
       Selection.ShapeRange(1).OLEFormat.DoVerb VerbIndex:=wdOLEVerbPrimary
       Selection.WholeStory 'working on document
       Selection.Copy
    End If
    i = i + 1
Next

它从Word级别开始工作,但当我尝试从Excel运行时,我有error 424 Object required

您对我如何更改代码有什么想法吗?

0 个答案:

没有答案