VBA – Padding a String To A Desired Length

Pad String Left or Right

Ever needed to control the length of a string to align content and needed to ‘pad’ the string with spaces?!

This can be a common need when generating text files, populating Textboxes, …

VBA String Padding

Today, I thought I’d share a very simple solution that can be used to pad a string from either side.

Continue reading

VBA – Expand Short File or Path

Ok, I’ll admit it, expanding a Short format File or Directory Path is a niche ask, but I recently required this ability and so I thought I’d share my solution in case anyone else was faced with this need.

Where did my need come from exactly?

Well, I was setting a Reference dynamically and the technique utilized a registry value which was in Short format. I then wanted to validate, but couldn’t because the Reference Path had been expanded to Long format. Thus, I needed that same ability so I could compare apples with apples.

Continue reading

Access – Playing With Database Properties

Child Playing With Bubbles

Today, I thought we’d take a look at playing around with Database Properties:

  • Listing the Properties
  • Getting the Value of a Specific Property
  • Creating a Property
  • Deleting a Property

To simplify my code, I am using my oCurrentDb Self-Healing Object Variable (SHOV).  If you’re not familiar with that yet, then start off by reviewing:

Or if your truly don’t want to learn/use SHOV, in all the code below, simply replace ‘oCurrentDb’ with ‘CurrentDb’.

Now, let the fun begin!
 
Continue reading

Access Pivot Tables and Pivot Charts

Surprised to see someone talking about using Pivot Tables and Pivot Charts, aren’t you!

For those that aren’t already aware, Microsoft did away with these, too much protest I must say, with the release of Access 2013.

To Much Protest ....
When I mention “to mush protest” I was referring to the deluge (by Access standards) on Uservoice asking to have the feature reinstated.  There were numerous suggestions all asking for the same thing and 2 of which were the 2nd and 5th most supported requests, yet both were ‘No Current Plan’.  You can view all the details for yourself by perusing:

Over the years I’ve seen numerous questions relating to how we could get them back…. So that got me thinking and I came up with a couple possible solutions:

  • use the WebBrowser control to replicate the features
  • automate Excel and create them there instead

In this article, I will concentrate on the latter and perhaps in the future (if there is some interest) I will explore the automation of Excel option.
Continue reading

Developing Project Requirements and Specifications

Project Talk

I know, everyone’s favorite subject!

I also know many developers skip over this step. (Don’t be one of those people!)

What Are Requirements

Requirements document what is needed and should not explain how it will be accomplished.  It is a list of wants and needs.

What exactly is it that your client needs.
What is expected of you as a developer.

This is typically the responsibility of the client to create, but I have helped numerous clients define these while developing Specifications to ensure I was accurately perceiving their projects accurately.

Don’t just take verbal requirements.  Put them down in writing, even an e-mail, and get the client to acknowledge them.

What Are Specifications

In the simplest terms, specifications explain how you will attain the requirements.

What is it that your solution will do and how it will be composed to do so.

This document is created by the developer to explain to the client how they propose to address their Requirements.  Some aspects will be simply repeating requirements (in a reworded way), this is normal.
Continue reading

Microsoft Office Trusted Documents and Trusted Locations

Let’s talk about Trust.

When Office 2007 came out Microsoft introduced their new security measure Trusted Documents and Locations. Until a document was Trusted, the macros/VBA code would be disabled to avoid malicious code from running accidentally.

Thus, for documents with Macros, VBA code, until they are trusted in some manner you will see notifications similar to:

In Access you’ll see:
Access - Security Warning - Active Content Has Been Disabled

In Excel, Word, … you’ll see:Excel and Word - Security Warning - Macros Have Been Disabled
Continue reading

Should We Be Afraid of Microsoft’s New Update Strategy?

If you haven’t heard yet, a few days ago Microsoft announced a new and improvement update strategy for MS365 Apps.

 

Microsoft has developed an optimization that applies a pending Microsoft 365 Apps update while a machine is in idle or locked mode

If there are running Office apps, update under lock will try to shut them down only when safe to do so, apply the pending update, and restore any closed apps to their previous state.

Continue reading

Access – Manipulating and Parsing Text

Today, I thought I’d go back to the basic and create a simple article to go over text parsing techniques and illustrate how we can use a few built-in function to get what we want from a string.

If you are new to VBA and text parsing, you’re probably asking yourself: which functions?  Well, in this article I will touch upon:

  • Len
  • Right
  • Left
  • Mid
  • InStr
  • InStrRev
  • Trim
  • LTrim
  • RTrim

So let’s get started

Continue reading

Microsoft Access Command-Line Switches

Windows Command Prompt Icon

I thought I’d covered a basic aspect of Microsoft Access, the Command-Line Switches, and how to use them.

Access Command-Line Switches

So what Command-Line Switches are available to us exactly? Below are lists of Official and Not So Official Microsoft Access Command-Line Switches.
Continue reading