Interop Word Add Shape Giving Exeption - Public 成员 'Shapes' 类型 'ApplicationClass' 未找到

Interop Word Add Shape Giving Exeption - Public member 'Shapes' on type 'ApplicationClass' not found

我正在将图像添加到 word 文件,我找到了一个解决方案。当我对我的代码实施该解决方案时。我正在给 System.MissingMemberException: Public 成员 'Shares' 类型 'ApplicationClass' 未找到。

    Dim autoScaledInlineShape As InlineShape = wordApp.Selection.InlineShapes.AddPicture(strImageFileName)
    Dim scaledWidth As Single = autoScaledInlineShape.Width
    Dim scaledHeight As Single = autoScaledInlineShape.Height
    autoScaledInlineShape.Delete()
    Dim newShape As Microsoft.Office.Interop.Word.Shape = wordApp.Shapes.AddShape(1, 0, 0, scaledWidth, scaledHeight)
    newShape.Fill.UserPicture(strImageFileName)
    Dim finalInlineShape As InlineShape = newShape.ConvertToInlineShape()
    finalInlineShape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse
    finalInlineShape.Range.Cut()
    wordApp.Selection.Paste()

谢谢。

Shapes属性属于Documentclass,不属于Application.

Dim autoScaledInlineShape As InlineShape = wordApp.Selection.InlineShapes.AddPicture(strImageFileName)
    Dim scaledWidth As Single = autoScaledInlineShape.Width
    Dim scaledHeight As Single = autoScaledInlineShape.Height
    autoScaledInlineShape.Delete()
    Dim newShape As Microsoft.Office.Interop.Word.Shape = wordApp.ActiveDocument.Shapes.AddShape(1, 0, 0, scaledWidth, scaledHeight)
    newShape.Fill.UserPicture(strImageFileName)
    Dim finalInlineShape As InlineShape = newShape.ConvertToInlineShape()
    finalInlineShape.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse
    finalInlineShape.Range.Cut()
    wordApp.Selection.Paste()