It has to be declared as a public variable:
http://www.cpearson.com/excel/TrulyGlobalVariables.htm
Here's some good insight into what ThisWorkbook is for:
http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx
Normally, I use that for automating something on WorkBook_Open or
WorkBook_Close events.
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
"Phyllis" wrote:
> I want to define such items as
> public ws as worksheet
> public rg as range
>
> I put them in the general declarations for "This Workbook". All other
> variables such as integer, string etc. are behaving as global. But not the
> objects. I read some discussion about defining them as I indicated above,
> but when I go to another module, it gives me the error that the name is not
> defined.
> Can objects be global? If so, is there a certain place they have to be
> defined