Try registering the dll with the /codebase switch.
ALso, Google for COMRegisterFunction and COMUnregisterFunction.
"ewm" wrote:
> I created a .dll with multiple functions for use from Excel. I am using
> CreateObject in Excel to create the object. My problem is the CreateObject
> call error with "Automation Error. The system cannot find the path
> specified." This only occurs when I try to use the .dll on a machine
> different from the one I created it on. I have registered the .dll using
> regasm assemblyname /tlb and have registered the dll in the GAC. Any ideas
> what is wrong?
>
> Here's the code:
>
> AssemblyInfo.cs
>
> using System.Reflection;
> using System.Runtime.CompilerServices;
> using System.Runtime.InteropServices;
>
> // General Information about an assembly is controlled through the following
> // set of attributes. Change these attribute values to modify the information
> // associated with an assembly.
> [assembly: AssemblyTitle("OEExcel")]
> [assembly: AssemblyDescription("")]
> [assembly: AssemblyConfiguration("")]
> [assembly: AssemblyCompany("")]
> [assembly: AssemblyProduct("OEExcel")]
> [assembly: AssemblyCopyright("Copyright © 2009")]
> [assembly: AssemblyTrademark("")]
> [assembly: AssemblyCulture("")]
>
> //Strong Name
> [assembly:AssemblyKeyFile("D:\\VSProjects\\OEExcel\\OEExcel\\bin\\Release\\OEExcel.snk")]
>
> // Setting ComVisible to false makes the types in this assembly not visible
> // to COM components. If you need to access a type in this assembly from
> // COM, set the ComVisible attribute to true on that type.
> [assembly: ComVisible(true)]
>
> // The following GUID is for the ID of the typelib if this project is
> exposed to COM
> [assembly: Guid("231df3f2-2f71-494a-9776-01029e92dd1d")]
>
> // Version information for an assembly consists of the following four values:
> //
> // Major Version
> // Minor Version
> // Build Number
> // Revision
> //
> // You can specify all the values or you can default the Build and Revision
> Numbers
> // by using the '*' as shown below:
> // [assembly: AssemblyVersion("1.0.*")]
> [assembly: AssemblyVersion("1.1.0.0")]
> [assembly: AssemblyFileVersion("1.1.0.0")]
>
>
> Implementation Code
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using System.Runtime.InteropServices;
> using System.Data;
> using System.Data.Sql;
> using System.Data.SqlClient;
> using System.Data.SqlTypes;
>
>
> namespace OEExcel
> {
> [Guid("16FBF6A5-B5E3-4332-8E4F-B0519BC5A59A")]
> [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
> public interface _CanopyInterface
> {
> [DispId(1)] int CreateOrder(string CustomerCode, int
> WarehouseCode, string UserID_EnteredBy, string ScheduledShipDate,
> string Customer_PO, int SalespersonCode);
> [DispId(2)] int AddOrderLine(int OrderNumber, string ProductCode,
> double OrderQuantity, double PriceOverride, string UM_SellBy, string UM_Prc);
> [DispId(3)] void SetValues(int Warehouse, string UserID);
>
> }
>
> [Guid("5ACBCF1C-BDE7-40a2-B8DC-813B7B681235")]
> [ClassInterface(ClassInterfaceType.None)]
> [ProgId("CanopyInterface")]
> public class CanopyInterface : _CanopyInterface
> /*
> * Name: CanopyInterface
> * Author: ewm
> * Date: 4/2009
> * Copyright: Edward Miller, 2009
> * Purpose: Creates and order in Aspen Systems, Inc. Canopy ERP
> system from and Excel spreadsheet.
> *
> * Usage:
> *
> *
> */
>
> Below here is just standard C# code to do the things I want.
>
> One thing to note. If I add OEExcel as a reference to my Excel worksheet, it
> shows in the object browser complete with all exposed functions; however, the
> object still wont create using
> Dim oInterface As myClassName
> Set oInterface = New myClassName
>
> Any ideas?
|