Get Name of Current VBA Function

There’s nothing to get the current function name, but you can build a fairly lightweight tracing system using the fact that VBA object lifetimes are deterministic. For example, you can have a class called ‘Tracer’ with this code: Private proc_ As String Public Sub init(proc As String) proc_ = proc End Sub Private Sub Class_Terminate() … Read more

VBA Run-time error 438 appears when “paste” runs

Try Selection.PasteSpecial xlPasteAll Paste by itself works on several objects, most notably Worksheet but not on a Range object which is what your Selection is. To paste to a Range you really have to use the PasteSpecial method with its’ available arguements such as xlPasteAll; xlPasteValues; xlPasteFormulas; xlPasteFormats and others which you can see by … Read more

Using VBA and VBA-JSON to access JSON data from WordPress API

The JsonConverter is returning a collection of VBA.Collections Scripting.Dictionaries, and Values. In order to understand the output you will have to test the TypeName of all the returned values. The real question is “How to navigate through a json object (or any unknown object for that matter) and access the values within. Immediate Window Using … Read more

ODBC Call Failed with stored procedure – Pass through query

To get more information about the cause of an “ODBC–call failed.” error we can loop through the DBEngine.Errors collection and see if there are other messages that might be a bit more descriptive. For example, with the code qdf.Connect = strConnectionString qdf.SQL = ” EXEC [dbo].[SAMPLE_TEST]” qdf.ReturnsRecords = True On Error GoTo oops Set rst … Read more