Working with current open email

I don’t know exactly what’s wrong with your code. For one thing, though, you are not validating that a new, editable email is even open. The following proof-of-concept does exactly what I think you’re looking to do: insert some text into the active email being composed. If this is not possible it displays a message … Read more

How do I loop an excel 2010 table by using his name & column reference?

I’m not very familiar with the shorthand method of referring to tables. If you don’t get an answer, you might find this longhand method, that uses the ListOject model, useful: Sub ListTableColumnMembers() Dim lo As Excel.ListObject Dim ws As Excel.Worksheet Dim lr As Excel.ListRow Set ws = ThisWorkbook.Worksheets(2) Set lo = ws.ListObjects(“tabWorkers”) For Each lr … Read more

Copy an array reference in VBA

Yes, you can, if both variables are of type Variant. Here’s why: The Variant type is itself a wrapper. The actual bit content of a Variant is 16 bytes. The first byte indicates the actual data type currently stored. The value corresponds exactly the VbVarType enum. I.e if the Variant is currently holding a Long … Read more

VBA hash string

Maybe others will find this useful. I have collected some different functions to generate a short hash of a string in VBA. I don’t take credit for the code and all sources are referenced. CRC16 Function: =CRC16HASH(A1) with this Code hash is a 4 characters long HEX string 19 code lines 4 digits long hash … Read more

VBA inheritance, analog of super

The usual way to do this in VBA is to have A contain an instance of B as well as having A implement B’s interface, and then delegate calls to the B interface of A to the internal B. This is old stuff, but see the Visual Studio 6.0 Programmer’s Guide: http://msdn.microsoft.com/en-us/library/aa716285(VS.60).aspx There is a … Read more

Missing VBA compiler message for wrong method name

As I have been explained (kudos go respectively), this is a COM feature. By default COM assumes an interface is extensible, that is, it allows adding members at run time. If that is not the desired behaviour, one can apply the [nonextensible] attribute to the interface definition, which declares the interface only accepts methods explicitly … Read more