research Question

Correct terminology for VBA Dim var As xxxxx.yyyyy. What is xxxxx and yyyyy?

Avatar of Robert Berke
Robert BerkeFlag for United States of America asked on
Microsoft OfficeVBA* Object Oriented Programming
13 Comments1 Solution32 ViewsLast Modified:
This is a question about the  terminology for “Dim var as  xxxxx.yyyyy “.  
For many years I loosely used terms like Library, Class, Type. But I am now trying to be more precise and find that I am confused.
For example: The following line defines an object with type Shellwindows from the ShDocVw Library,  
Dim var2 As New SHDocVw.ShellWindows
So it would appear that the general syntax is simple:
                Dim var As Library.Type
But I attach an image with a green circle that makes me wonder if the syntax is  
Dim var As Library.Class.
And eventually (but not now) I may ask a related question about CreateObject(class, [ servername ])
The image shows the following for Shellwindows.
    Class ShellWindows
    Member of SHDocVw     
    ShellDispatch Load in Shell Context
    Library SHDocVw
    Microsoft Internet Controls
IN OTHER WORDS ShellWindows is a Class that is the member of the SHDocVw library which is from ieframe.dll

What it the correct terminology?
Microsoft documentation is not simple. syntax shows.  
Dim [ WithEvents ] varname [ ( [ subscripts ] ) ] [ As [ New ] type ] [ , [ WithEvents ] varname [ ( [ subscripts ] ) ] [ As [ New ] type ]] .
Where type is  Byte ,..etc… or an object type.
And Object type is: “A type of object exposed by an application through Automation, for example, Application, File, Range, and Sheet. Use the Object Browser or refer to the application's documentation for a complete listing of available objects.”
Clear as mud!
And here are several variable types that might be worth discussing
dim var0 as object
set var0 =  createobject ("Excel.Application")  ' vba help says syntax is CreateObject(class, [ servername ])
Dim var1 As New Scripting.Dictionary
Dim var2 As New SHDocVw.ShellWindows
Dim var3 As New Dao.Recordset
Dim var4 As New Scripting.FileSystemObject
Dim var5 As New Scripting.Folder
dim var6 As New Dataobject
dim var7 as New Excel.Application

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 13 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 13 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004