Archive for the ‘Variables and Data Types’ Category.
Hi everyone,
The release date of Office 2010 is closing in and with this new version we’ll have a new programming challenge. Office 2010 comes in a 32 bit and a 64 bit version.
Especially API function declarations need to be adjusted for the 64 bit environment.
We’ll have to change a declaration like this one:
Private [...]
IsMissing is a built-in function that can be used to see if an optional, Variant argument was passed to a sub or function. Since optional arguments are, well, optional, your code needs to determine if they’ve been supplied. If the optional argument is declared as a Variant data type, the IsMissing function will [...]
Since Professional Excel Development was published, I’ve been using the error handling method described in chapter 12. It’s very comprehensive and easy to implement. It’s no guarantee that my code is right, of course, but it does guarantee that the end user won’t be plopped into the VBE when an error occurs.
I also [...]
In Long vs. Integer we settled, once and for all, the debate over integer data types. But what about floating point? Pace recently asked which was better, single or double. (Pace: I know it was two months ago, but cut me some slack.) My gut reaction is that Double is the [...]
I have an array of user defined types. The type has three elements and I need to sort on all three. Surprisingly, I’ve never had to sort an array of udt’s before. Here’s how I did it:
Type MyInfo
lType As Long
sName As String
dStart As Date
End Type
Sub Start()
[...]
I have an invoice template that has a formula to compute tax, namely
=ROUND(SUMIF(bdyTaxFlag,"T",bdyAmt)*cnsStateTaxRate,2)
If I put a ‘T’ in a certain column, this will compute tax on that amount. I used a named constant, cnsStateTaxRate, for some reason that escapes me now. I probably thought that I was some kind of decent developer and [...]
Hi, I’m the dot operator. You may remember me from such VBA statements as object.property and object.method.
Okay, enough of that. When you see a dot operator in a Dim statement, you’re seeing it in the form of library.object. For instance, if you’re automating Outlook, you may use:
Dim olMail As Outlook.MailItem
Outlook isn’t an [...]
Thanks for opening this forum up to other MVP authors, Dick. As some of you may know by now, I tend to ramble, so I’ll do my best to keep this entry short and to the point.
VB(A) is notoriously inefficient when working with Strings, so anything we can do to speed up our code [...]