1

I've created a simple application .net Class that converts an excel spreadsheet into a pdf file. I then get an Excel 2007 application to call this dll which works fine on my development machine.

However, when I deploy it on to a Vista machine, that has both the .net framework and Excel 2007, I get this error:

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.

Can someone please help me resolve this?

This is how I'm calling .net tlb file from Excel 2007.

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.

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();
            }  
        }
    }
}
2
  • 1
    I assume that your 'PrintLibrary.dll' was built using .NET? Does it have any COM-visible classes or interfaces? If not, then no need to register. If so, I assume that you are using RegAsm to register it, or are you (incorrectly) trying to use RegSvr32? When you run your code and get "run-time error '429' activex component can't create object", what line of code is it? (That is, what object is it trying to create -- are you sure its something from your 'PrintLibrary.dll?) Commented Apr 17, 2010 at 11:13
  • hi Mike, thanks for coming back to me on this. I create a reference to the .net tlb library that visual studio creates. It seems to break on this line...printLibraryTest.ConvertExcelToPdf. Do i still need to use Regasm, even though Visual Studio has created a tlb library? I am also using ClassInterface(ClassInterfaceType.None, so no class interface is generated for the class. Commented Apr 22, 2010 at 11:02

2 Answers 2

1

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

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. 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.

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'

Sign up to request clarification or add additional context in comments.

Comments

0

Excel 2007 VB Script Run-time Error 429 when execute:

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

Solution:

  1. Check "My Documents" location it pointed.
  2. Check Excel Option save location.
  3. Run "regsvr32 scrrun.dll".

References:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.