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

VB6 Editor changing case of variable names

Since I always find this thread first looking for a solution to messed-up casing, here is one Simon D proposed in a related question: If you just need to fix one variable’s casing (e.g. you accidentally made a cOrrectCAse variable and now they are all over the place), you can correct this for good by … Read more

Implementing String.Format() in VB6

I couldn’t find one anywhere, so I made my own: Public PADDING_CHAR As String Public Function StringFormat(format_string As String, ParamArray values()) As String ‘VB6 implementation of .net String.Format(), slightly customized. ‘Tested with Office 2010 VBA (x64) Dim return_value As String Dim values_count As Integer ‘some error-handling constants: Const ERR_FORMAT_EXCEPTION As Long = vbObjectError Or 9001 … Read more

VB6 IDE cannot load MSCOMCTL.OCX after update KB 2687323

After hours of effort, system restore, register, unregister cycles and a night’s sleep I have managed to pinpoint the problem. It turns out that the project file contains the below line: Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX The version information “2.0” it seems was the reason of not loading. Changing it to “2.1” in notepad solved the problem: Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0; … Read more

Escape double quote in VB string

Escaping quotes in VB6 or VBScript strings is simple in theory although often frightening when viewed. You escape a double quote with another double quote. An example: “c:\program files\my app\app.exe” If I want to escape the double quotes so I could pass this to the shell execute function listed by Joe or the VB6 Shell … 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)