简体   繁体   English

运行时错误“ 429” activex组件无法创建对象

[英]run-time error '429' activex component can't create object

I've created a simple application .net Class that converts an excel spreadsheet into a pdf file. 我创建了一个简单的应用程序.net类,它将一个Excel电子表格转换为pdf文件。 I then get an Excel 2007 application to call this dll which works fine on my development machine. 然后,我得到一个Excel 2007应用程序来调用此dll,该dll在我的开发计算机上正常运行。

However, when I deploy it on to a Vista machine, that has both the .net framework and Excel 2007, I get this error: 但是,当我将其部署到同时具有.net框架和Excel 2007的Vista计算机上时,出现此错误:

run-time error '429' activex component can't create object

Even though I am an administrator on the machine, I cannot seem to put signed .net dlls into the GAC. 即使我是计算机的管理员,我似乎也无法将签名的.net dll放入GAC。

Can someone please help me resolve this? 有人可以帮我解决这个问题吗?

This is how I'm calling .net tlb file from Excel 2007. 这就是我从Excel 2007调用.net tlb文件的方式。

Sub TestSub()<br>
 &nbsp;Dim printLibraryTest As PrintLibrary.Print<br>
 &nbsp;Set printLibraryTest = New PrintLibrary.Print <br>
 &nbsp; printLibraryTest.ConvertExcelToPdf <br>
End Sub <br>

This is .net library below. 这是下面的.net库。

using System;<br>
using System.Collections.Generic;<br>
using System.Runtime.InteropServices;<br>
using System.Text;<br>
using Microsoft.Office.Interop.Excel;<br><br>

namespace PrintLibrary<br>
{<br>
    [ClassInterface(ClassInterfaceType.None)]<br>
    [Guid("3d0f04d2-9123-48e0-b12f-6c276ff2281b")]<br>
    [ProgId("PrintLibrary.Test")]<br>
    public class Print<br>
    {      <br>
        public void ConvertExcelToPdf(string inputFile,string outputFile)    <br>
        {    <br>
          &nbsp;&nbsp;  ApplicationClass excelApplication = new ApplicationClass();    <br>
          &nbsp;&nbsp;   Workbook excelWorkBook = null;    <br>
          &nbsp;&nbsp;  string paramSourceBookPath = inputFile;    <br>
          &nbsp;&nbsp;   object paramMissing = Type.Missing;    <br>

          string paramExportFilePath = outputFile;
          XlFixedFormatType paramExportFormat = XlFixedFormatType.xlTypePDF;
          XlFixedFormatQuality paramExportQuality =
          XlFixedFormatQuality.xlQualityStandard;
          bool paramOpenAfterPublish = false;
          bool paramIncludeDocProps = true;
          bool paramIgnorePrintAreas = true;
          object paramFromPage = Type.Missing;
          object paramToPage = Type.Missing;


            try
            {
                // Open the source workbook.
                excelWorkBook = excelApplication.Workbooks.Open(paramSourceBookPath,
                paramMissing, paramMissing, paramMissing, paramMissing,
                paramMissing, paramMissing, paramMissing, paramMissing,
                paramMissing, paramMissing, paramMissing, paramMissing,
                paramMissing, paramMissing);

                // Save it in the target format.
                if (excelWorkBook != null)
                    excelWorkBook.ExportAsFixedFormat(paramExportFormat,
                    paramExportFilePath, paramExportQuality,
                    paramIncludeDocProps, paramIgnorePrintAreas, paramFromPage,
                    paramToPage, paramOpenAfterPublish,
                    paramMissing);
            }
            catch (Exception ex)
            {
                // Respond to the error.
            }

Finally 最后

            {
                // Close the workbook object.
                if (excelWorkBook != null)
                {
                    excelWorkBook.Close(false, paramMissing, paramMissing);
                    excelWorkBook = null;
                }

                // Quit Excel and release the ApplicationClass object.
                if (excelApplication != null)
                {
                    excelApplication.Quit();
                    excelApplication = null;
                }

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }  
        }
    }
}

One year later ... 一年之后 ...

Is it possible that this may be due to the same reason than this : http://support.microsoft.com/kb/313984/en-us 是否可能是由于与以下原因相同的原因: http : //support.microsoft.com/kb/313984/en-us

The error occurs because the target computer is missing the license information for the control objects that are used in the application [...] This would generate a setup package that contains the correct version of the Winsock control. 发生错误是因为目标计算机缺少应用程序中使用的控件对象的许可证信息。这将生成包含正确版本的Winsock控件的安装程序包。 However, the license key for the control will not be compiled into the application unless an instance of the control is placed on a form. 但是,除非将控件的实例放在窗体上,否则控件的许可证密钥将不会编译到应用程序中。 When you try to instantiate the objects at run time, the application has no way to provide the license key, and the code will fail. 当您尝试在运行时实例化对象时,应用程序无法提供许可证密钥,并且代码将失败。 For example, the following code will run properly at design time, but will fail at run time on computers that do not have Visual Basic installed. 例如,下面的代码将在设计时正常运行,但在未安装Visual Basic的计算机上,将在运行时失败。

There seems to be a relation to your case here : 似乎与您的案件有关:

  • Same error number and message 错误号和消息相同
  • Happens at the same time : when you deploy to a non dev machine 同时发生:当您部署到非开发机器时

The workaround seems to be placing the control on a form. 解决方法似乎是将控件放在窗体上。


Check out this article too : Run-time error '429' 也查看此文章: 运行时错误“ 429”

Excel 2007 VB Script Run-time Error 429 when execute: 执行时Excel 2007 VB脚本运行时错误429:

Set objFSO = CreateObject("Scripting.FileSystemObject").

Solution: 解:

  1. Check "My Documents" location it pointed. 检查它指向的“我的文档”位置。
  2. Check Excel Option save location. 检查Excel选项的保存位置。
  3. Run "regsvr32 scrrun.dll". 运行“ regsvr32 scrrun.dll”。

References: 参考文献:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ActiveX组件无法创建对象VBA运行时错误 - ActiveX component can't create object VBA runtime error ActiveX组件无法创建对象? .NET COM - ActiveX component can't create object? .NET COM Regasm 不工作/ActiveX 组件无法创建对象 - Regasm is not working / ActiveX component can't create object 0x800a01ad - Microsoft VBScript 运行时错误:ActiveX 组件无法创建对象 - 0x800a01ad - Microsoft VBScript runtime error: ActiveX component can't create object ActiveX组件无法创建对象COM互操作 - ActiveX component can't create object COM interop Windows 7:ActiveX组件无法创建对象 - Windows 7: ActiveX component can not create object ActiveX组件无法创建对象:在注册dll时没有名称空间的类会发生什么情况? - ActiveX component can't create object: what happens to classes that don't have a namespace when the dll is registered? .NET进程无法创建ActiveX对象 - .NET Process can't create ActiveX Object 在VB6应用程序中,ac#dll的CreateObject仅在IDE中“ActiveX组件无法创建对象”失败 - In VB6 application, CreateObject for a c# dll fails with “ActiveX component can't create object” in IDE only VBA运行时错误:&#39;459&#39;使用自定义ActiveX控件运行userform时出现外部异常 - VBA Run-time error: '459' External exception when running userform with custom ActiveX control
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM