A Simple C# DLL – how do I call it from Excel, Access, VBA, VB6?

You can’t access a static member via COM interop. In fact your code doesn’t even compile, the method should be in a class. Here is how you can do it: [InterfaceType(ComInterfaceType.InterfaceIsDual)] [Guid(“01A31113-9353-44cc-A1F4-C6F1210E4B30”)] //Allocate your own GUID public interface _Test { string HelloWorld { get; } } [ClassInterface(ClassInterfaceType.None)] [Guid(“E2F07CD4-CE73-4102-B35D-119362624C47”)] //Allocate your own GUID [ProgId(“TestDll.Test”)] public class … Read more

Difference between Visual Basic 6.0 and VBA

For nearly all programming purposes, VBA and VB 6.0 are the same thing. VBA cannot compile your program into an executable binary. You’ll always need the host (a Word file and MS Word, for example) to contain and execute your project. You’ll also not be able to create COM DLLs with VBA. Apart from that, … Read more

What does the Call keyword do in VB6?

From the MSDN: You are not required to use the Call keyword when calling a procedure. However, if you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around argumentlist. If you use either Call … Read more

Is there a Visual Basic 6 decompiler? [closed]

For the final, compiled code of your application, the short answer is “no”. Different tools are able to extract different information from the code (e.g. the forms setups) and there are P code decompilers (see Edgar’s excellent link for such tools). However, up to this day, there is no decompiler for native code. I’m not … Read more

What is the difference between dim and set in vba

There’s no reason to use set unless referring to an object reference. It’s good practice to only use it in that context. For all other simple data types, just use an assignment operator. It’s a good idea to dim (dimension) ALL variables however: Examples of simple data types would be integer, long, boolean, string. These … Read more

What is the difference between Dim, Global, Public, and Private as Modular Field Access Modifiers?

Dim and Private work the same, though the common convention is to use Private at the module level, and Dim at the Sub/Function level. Public and Global are nearly identical in their function, however Global can only be used in standard modules, whereas Public can be used in all contexts (modules, classes, controls, forms etc.) … Read more