Hello,
I have followed a guide to use a library created in C# with the Register COM Interop option using Visual studio 2008 and .NET 3.5 (also tried on 2.0 and vs 2005)
i then created a tlb from the output dll using regasm filename.dll /tlb:filename.tlb
now back in excel, the library was added in references, i checked it so it's used in my project however i can't create any object with that class, and in the object properties, if i select that library, it shows no items in it
Here's the code for the C# library

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;


namespace ScreenCapture
{
    public class ScreenCapture
    {
        private static Bitmap bitmapScreenshot;
        private static Graphics graphicsScreenshot;
        public static void SaveScreenshot(String filename)
        {
            bitmapScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
            graphicsScreenshot = Graphics.FromImage(bitmapScreenshot);
            graphicsScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
            bitmapScreenshot.Save(filename, ImageFormat.Png);
        }
    }
}

just in case someone's interested, there was a missing option, in the project properties, assembly information, you have to check make this library COM-visible or sth

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.