C# 如何用C语言在Excel中删除自定义列表#

C# 如何用C语言在Excel中删除自定义列表#,c#,excel,excel-interop,C#,Excel,Excel Interop,我试图用C语言删除Excel自定义列表中的列表。但是我的程序无法删除我想要的列表。我不知道我的程序有什么问题。很遗憾,我没有注意到任何错误。 我希望有人能帮我修一下。 非常感谢你 对象自定义列表内容; 对于(int i=5;i我想你所需要的是: Globals.ThisAddIn.Application.DeleteCustomList(Globals.ThisAddIn.Application.GetCustomListNum(new string[] { "China", "Taiwan"

我试图用C语言删除Excel自定义列表中的列表。但是我的程序无法删除我想要的列表。我不知道我的程序有什么问题。很遗憾,我没有注意到任何错误。 我希望有人能帮我修一下。 非常感谢你

对象自定义列表内容;

对于(int i=5;i我想你所需要的是:

Globals.ThisAddIn.Application.DeleteCustomList(Globals.ThisAddIn.Application.GetCustomListNum(new string[] { "China", "Taiwan" }));
这里是相同的,稍微简单一点,但也更长:


// get an application object
Excel.Application xlApp = Globals.ThisAddIn.Application;

// assign the list you want to remove to an array
string[] myList = new string[] { "China", "Taiwan" };

// get the number of your list from Excel application
int listNum = xlApp.GetCustomListNum(myList);

// delete the list by its number - it's the only way to delete 
// a custom list that I've found
xlApp.DeleteCustomList(listNum);

office版本是什么?这是office 2016,任何人都可以帮我吗?抱歉,有点忙。请在10小时内提醒我。到时候我会回家安装office 2016。非常感谢。我期待着您的来信。

// get an application object
Excel.Application xlApp = Globals.ThisAddIn.Application;

// assign the list you want to remove to an array
string[] myList = new string[] { "China", "Taiwan" };

// get the number of your list from Excel application
int listNum = xlApp.GetCustomListNum(myList);

// delete the list by its number - it's the only way to delete 
// a custom list that I've found
xlApp.DeleteCustomList(listNum);