C# Visual studio tools for office gives this error: Excel is running into problems with the X add-in
C# Visual studio tools for office gives this error: Excel is running into problems with the X add-in
我正在尝试 运行 visual studio 办公室工具中的示例,但是当我尝试 运行 它 Excel 时出现此错误:
Excel is running into problems with the X add-in. If this keeps happening disable this add-in and check for available updates
我的代码如下:
private void btnA2P_Click(object sender, RibbonControlEventArgs e)
{
Microsoft.Office.Interop.Excel.Range currentFind = null;
Microsoft.Office.Interop.Excel.Range firstFind = null;
Microsoft.Office.Interop.Excel.Range AllWords = Globals.ThisAddIn.Application.get_Range("A1", "B3");
currentFind = AllWords.Find("a", Type.Missing,
Microsoft.Office.Interop.Excel.XlFindLookIn.xlValues, Microsoft.Office.Interop.Excel.XlLookAt.xlPart,
Microsoft.Office.Interop.Excel.XlSearchOrder.xlByRows, Microsoft.Office.Interop.Excel.XlSearchDirection.xlNext, false,
Type.Missing, Type.Missing);
while (currentFind != null)
{
currentFind.Replace(currentFind.Value, currentFind.Value.ToString().Replace("a", "b"));
if (firstFind == null)
{
firstFind = currentFind;
}
else if (currentFind.get_Address(Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1)
== firstFind.get_Address(Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1))
{
break;
}
currentFind.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
currentFind.Font.Bold = true;
currentFind = AllWords.FindNext(currentFind);
}
}
此外,当我想调试代码时,它 returns 来自 Find 方法的 null
Find 方法 returns null
如果没有找到匹配项。
哪一行代码导致了 plug-in 的问题? plug-in 你在说什么?
我正在尝试 运行 visual studio 办公室工具中的示例,但是当我尝试 运行 它 Excel 时出现此错误:
Excel is running into problems with the X add-in. If this keeps happening disable this add-in and check for available updates
我的代码如下:
private void btnA2P_Click(object sender, RibbonControlEventArgs e)
{
Microsoft.Office.Interop.Excel.Range currentFind = null;
Microsoft.Office.Interop.Excel.Range firstFind = null;
Microsoft.Office.Interop.Excel.Range AllWords = Globals.ThisAddIn.Application.get_Range("A1", "B3");
currentFind = AllWords.Find("a", Type.Missing,
Microsoft.Office.Interop.Excel.XlFindLookIn.xlValues, Microsoft.Office.Interop.Excel.XlLookAt.xlPart,
Microsoft.Office.Interop.Excel.XlSearchOrder.xlByRows, Microsoft.Office.Interop.Excel.XlSearchDirection.xlNext, false,
Type.Missing, Type.Missing);
while (currentFind != null)
{
currentFind.Replace(currentFind.Value, currentFind.Value.ToString().Replace("a", "b"));
if (firstFind == null)
{
firstFind = currentFind;
}
else if (currentFind.get_Address(Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1)
== firstFind.get_Address(Microsoft.Office.Interop.Excel.XlReferenceStyle.xlA1))
{
break;
}
currentFind.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);
currentFind.Font.Bold = true;
currentFind = AllWords.FindNext(currentFind);
}
}
此外,当我想调试代码时,它 returns 来自 Find 方法的 null
Find 方法 returns null
如果没有找到匹配项。
哪一行代码导致了 plug-in 的问题? plug-in 你在说什么?