我在用户端尝试exe时遇到此问题。用户有MicosoftExcel 2000,我有execel 2003.有人可以帮助我。C#,来自HRESULT的异常:0x80029C4A(TYPE_E_CANTLOADLIBRARY)
我已经创建了C#这个工具,并使用COM
if(strDataSheetFile.Trim().EndsWith(".xls") || strDataSheetFile.Trim().EndsWith(".xlsx"))
{
System.IO.StreamWriter file = null;
if (IfAbFile)
{
file = new System.IO.StreamWriter(AbaqusDeckFile.ToString(), true);
}
else
{
string[] strFILEnamesSplit = strDataSheetFile.Split(new Char[] { '\\' });
string ExpFile = "";
int ilnt = 0;
foreach (string strVal in strFILEnamesSplit)
{
if (ilnt < (strFILEnamesSplit.Length - 1))
{
ExpFile += strVal;
ExpFile += "/";
}
else
ExpFile += "Deck.inp";
ilnt += 1;
}
file = new System.IO.StreamWriter(ExpFile.ToString(), true);
}
List<List<double>> List_SheetValues = new List<List<double>>();
Excel.Application objexcel;
Excel.Workbook wbexcel;
Excel.Worksheet wsheet;
objexcel = new Excel.Application();
//strDataSheetFile = @"C:\Ajoy\Demos\IsoMount\IsoMount_Springs_database_updated.xls";
if (File.Exists(strDataSheetFile))
wbexcel = objexcel.Workbooks.Open(strDataSheetFile);
else
{
MessageBox.Show(" Please state the number of springs", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Application.UseWaitCursor = false;
return;
}
看起来,在你的VBA代码,您将使用所有的Excel版本的应用移植在您的机器上注册的类型库,但不在最终用户机器上。在最终用户机器的末尾检查参考对话框中是否有**(缺失)**的任何内容。 – JMK
嗨JMK,我用C#编写了这个代码。你有一个suggesion请 – user2982029
没有实际上是把你的代码的问题,并明确了线造成你,我们没有太多的去麻烦。 – JMK