Tag Archives: VBE

Smart Indenter Is Alive

One of my preferred add-ins for VBA development for many years was a small little indenting utility called Smart Indenter. It did one thing, automatically indent code to make it much more legible, but it did it well!

It has always been part of my add-ins page because it was so good:

Sadly, it seemed the product was abandoned by its’ developer some time around when Office 2007/x64 surfaced.

Over the years, I have seen people reporting various hacks to make the older version work with newer versions of office (I report a solution that worked for me), but others report those same hacks not solving the issue for them.  So it was a little luck of the draw if you could get it working.  I had a few posts on this as well:

Continue reading

VBA – Cannot jump to ‘…’ because it is hidden

I was perusing some recent posts on access-programmers.co.uk a couple days ago and came across a post by Pat Hartman:

I e-mailed Pat the following information and I thought this made good subject matter for a post to benefit all of you as well.

  Continue reading

VBA – Getting Summary Information About Your VBE Project

If you’re like me, you might have hundreds, or even thousands of databases and finding VBA code, know what is where might be a challenge to put things lightly.

In the past I provided a procedure to get some information about modules and procedures:

 

I thought I’d share a slightly modified version .  The reason this one can be useful is because you can actually use it to pull information for external databases, not just the current database.  I use this type of approach to create an inventory of modules/functions making it much easier to locate things in amongst all my databases, workbooks & documents.

It extracts a list of modules with your VBE projects and further enumerate the various procedures within each module providing information about the name, type, no lines of code, …

Continue reading

Access – VBE – Retrieve Procedure Text

Here’s a bit of an odd ball, but I was helping out in a forum discussion in which the user needed to be able to display the code behind procedures. He was trying to create some type of teaching tool.

Now there are different ways to approach such a thing and he could have copy/pasted each procedure into a table, but that creates duplication (which is never a good thing), creates maintenance since he’ll have to update entries as code is change, …

I found the question intriguing and set out to find a way to simply read the information from the VBA project. Building on some of my other VBE code, below is my solution

Continue reading

MS Access – VBA – HasModule

I was trying to help out in an UA discussion Form/report Document Hasmodule? in which Stuart was trying to find a way to determine if a form or report object had a module.

Now, the obvious answer is to simply use the HasModule property.  But no, in this instance that wasn’t a viable option.  Stuart needed a way to determine whether a form/report had a module without needing to open the object first as is required by the HasModule property.

A little head scratching later I came up with 3 functions that should accomplish the requested task and do not require opening the object beforehand.  Perhaps these can serve others.

Continue reading

VBA – Find Term in VBA Modules/Code

Sometimes I need to perform searches in the VBA code to try and cleanup client databases, and sometimes Mz_tools, although an exceptional add-in, just doesn’t give me enough flexibility to perform the type of searches I need. It is rare, but it does happen.

Below is a generic procedure to search through all your VBA code for a term. As it stands below, it offers little benefit over Mz-Tools, but it allows you the flexibility to modify it as you see fit to do things Mz-Tools simply can’t.

For instance, I needed to search through the VBA code of a database looking for a given term, where the next line included a specific function. There is simply no way to do this with Mz-Tools, but I added one line to my code below and presto I had my listing to work off of. And let me tell you when you are dealing with complex databases with 100’s of forms modules, reports module, modules, class modules, a routine like the one below can make a drastic improvement!

I must also state that I was surprised by the speed of such a search, it is fast considering the quantity of code I was combing through when I last used it. Access & VBA never cease to amaze me sometimes.
 
Continue reading