Finding source of some defined constants

mdlueck

Sr. Application Developer
Local time
Today, 08:18
Joined
Jun 23, 2011
Messages
2,650
Greetings,

I just realized that I do not know where my ShellAndWait module is obtaining the constant definitions for the WindowStyle arg. They are all defined presently:

Code:
? vbHide
 0 
? vbNormalFocus
 1 
? vbMinimizedFocus
 2 
? vbMaximizedFocus
 3 
? vbNormalNoFocus
 4 
? vbMinimizedNoFocus
 6
However, I would sort of like to know where the constants are actually defined that support my ShellAndWait VBA Module. I do not like relying on "osmosis"! :cool:
 
search online for say vbFocus and one or more of the links will give you the numeric (or whatever) equivalent.

I'm not aware of a single defined source for all of these - there must be thousands of them!
 
just reread your post and might have misunderstood. They will have declared within Access or one of the libraries used in references.

You'll note that when using some API's you have to declare them yourself when you call the api - or just use the numeric equivalent.
 
They will have declared within Access or one of the libraries used in references.

I did a global search through all VBA code, I find nowhere "vbNormalNoFocus" yet as I showed in my OP, the Immediate window does see the constant defined somehow.

I have only added a reference to "Microsoft Windows Common Controls 6.0 (SP6)".

You'll note that when using some API's you have to declare them yourself when you call the api - or just use the numeric equivalent.

Otherwise I rely on Late-Binding VBA coding style and have separate modules per would be reference to declare the constants the reference would have imported to VBA.

Thus, was surprised to see these constants for WindowStyle mysteriously defined.
 
Michael,

I am sorry to sound thick, but all these are enumeration values right? vbNormalFocus, vbSunday, vbWhite? In my general assumption I thought that all these variables (those that start with vb<someVariableName>) are predefined (as in constants declared) under the Visual Basic For Application reference, which is included by default.

If you go to the immediate window, type in vbNormalFocus, right click and go to Definition. You can see the variables, under the class VBA.

Or I am totally barking up the wrong tree?
 
In the VBA window, go to View>Object Browser. Ensure All Libraries is selected then in the find box, type in vbnormalnofocus and you will find it there
 
@Paul
If you go to the immediate window....
Learn something every day - I didn't know you could do that! All these years I've benn clicking on view/object browser:o
 
If you go to the immediate window, type in vbNormalFocus, right click and go to Definition. You can see the variables, under the class VBA.

Aaahhh, that is very nice.

And using that Object Browser, I see you have the ability to (for example) see what constants come with MSComctlLib only, so if I did not have to have that one checked as a reference in order to put the control on the form, then I could develop a Late-Binding VBA Module of the constants that library needed.

That is exactly what I was after. Thank you so much, pr2-eugin. :D
 

Users who are viewing this thread

Back
Top Bottom