Library Shell32
C:\WINDOWS\system32\SHELL32.dll
Microsoft Shell Controls And Automation
Open up your VBA IDE and set a reference to "Microsoft Shell Controls And Automation"
Now open your object browser and select "Shell32".
Under "Classes", select "Shell"
Note that one of the properties, to the right, is an "Application" property. This property returns an object reference to the windows shell.
When using CreateObject, the registry is searched for a program identifier. You are creating a latebound reference to an application object returned by the "Application" property of the "Shell" object which is contained in the "Shell32" library.
Your code, as is, is creating a "IShellDispatch4" object. Depending on your version, this may be IShellDispatch3 or IShellDispatch2. To see the properties and methods of this object, you will need to right click within your object browser and select, "Show Hidden Members".
I am trying to confuse you as best as I can.
Anyway, your code and what it is doing will become more clear to you if you early bind. That is, set a reference beforehand so the compiler knows what's up ahead of time... Also, the properties and methods will show up via intellisense as you type and any events will now be available to you as well.
Both return references to a "Shell" object.
Code:
Sub ExampleUsingEarlyBinding()
Dim MyShellObject As Shell32.shell
'or
'Dim MyShellObject As Shell32.IShellDispatch4
Set MyShellObject = New Shell32.shell
End Sub
Sub ExampleUsingLateBinding()
Dim ShellApp As Object
Set ShellApp = CreateObject("Shell.Application")
End Sub