使用 C# 加载项在 Word 2010 中制作自定义书签编辑器

Making a custom bookmark editor in Word 2010 with C# Add-In

我正在关注这个 MSDN 演练:https://msdn.microsoft.com/en-us/library/5eef9s6f.aspx

但是我收到以下行的错误:

Document extendedDocument = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);

错误是应用程序上的红色下划线,内容为:

'MyRibionAddin.MyRibbon does not contain a definition for 'Application' and no extension method 'Application' accepting a first argument of type 'MyRibionAddIn.MyRibbon' could be found ( are you missing a using directive or an assembly reference?)

替换为

 Document extendedDocument = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveDocument);

有效