Visual Basic – VBA – How to declare a WorkSpace variable

--> (Word) --> (PDF) --> (Epub)
This article has been published [fromdate]


I have Visual Basic 6.0
I want to Dim a variable as WorkSpace.
Been reading on it and wanted to check it out.
Anyway, it doesn't seem to be available. I have the Enterprise edition.
Any thoughts as to why it isn't an option?

Dim ws as not working.


The solution is the following:

  • Add a Reference to Microsoft DAO3.x Object Library;
  • From VBE (Visual Basic Editor) go to Project ---> References ---> Microsoft DAO3.x Object Library;

Now you could use/declare a [gs variable] as workspace by writing:

Dim variable As DAO.Workspace

...or by using:

Dim variable As Workspace



1 thought on “Visual Basic – VBA – How to declare a WorkSpace variable”

Comments are closed.