If not, why don't they?
If not, why don't they?
They do.
Change the library to VBA specifically. They're members of the vbVarType class. If you disable online connectivity, F1 will pop a useful list of all the types.
Make Mom proud: Add to my reputation if I helped out!
Make the Moderators happy: Mark the Thread as Solved if your question was answered!
The values are for use in Late Binding. If you reference the correct library (think translation guide) when building your project, you're using Early Binding. The Intellisense helps you code as your write.
Late Binding on the other hand, doesn't reference a library at all, but instead relies on the constant values to declare what you're talking about. Intellisense won't help as you go and it's kind of less user friendly, but more universal at the same time. If the recipient of your code didn't have the library intrinsics you reference, then the code would fail. However, the constant values will not.
I most commonly run into Late vs Early Binding when automating email from Excel or Access.
For example:
Late Bound
Early Bound![]()
Dim OutApp As Object Dim OutMail As Object Set OutMail = OutApp.CreateItem(0)
If I tried the run the second code bit without referencing Outlook, it would fail. The first works, because it calls a mail object by referencing it's constant value 0, instead of by the super user friendly olMailItem.![]()
Dim olNewApp As Outlook.Application Dim olNewMail As Outlook.MailItem Set olNewMail = olNewApp.CreateItem(olMailItem)
I've never had to give someone a serious project off my network, but if I was going to I'd probably go through and use as many constant values in place of instrinsics afterward and comment heavily throughout. This makes the code more stable in with regards to future MS Office updates and compatibility with various versions.
Last edited by daffodil11; 07-10-2015 at 06:10 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks