ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Type Scope (https://www.excelbanter.com/excel-programming/288919-type-scope.html)

Jim[_31_]

Type Scope
 
To all,

I created a Public Type in a module as follows,

Public Type AppInfo
UserAction As String
FolderSelected As String
DBFolder As String
DBFn As String
End Type

A procedure in the module shows a form and I fill appInfo
values, but when I unload the form the values are lost?

Why is that?

Jim




Chip Pearson

Type Scope
 
Jim,

Where are you declaring the variable of the specified Type? If
you declare the variable in the form's code, it will be lost when
the form is unloaded. If it is declared in the same procedure
that shows the form, it will remain in scope for that procedure.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Jim" wrote in message
...
To all,

I created a Public Type in a module as follows,

Public Type AppInfo
UserAction As String
FolderSelected As String
DBFolder As String
DBFn As String
End Type

A procedure in the module shows a form and I fill appInfo
values, but when I unload the form the values are lost?

Why is that?

Jim






No Name

Type Scope
 
It is declared in the Module that contains a Sub that
shows the Form. That's why I'm confused.

Jim




-----Original Message-----
Jim,

Where are you declaring the variable of the specified

Type? If
you declare the variable in the form's code, it will be

lost when
the form is unloaded. If it is declared in the same

procedure
that shows the form, it will remain in scope for that

procedure.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Jim" wrote in

message
...
To all,

I created a Public Type in a module as follows,

Public Type AppInfo
UserAction As String
FolderSelected As String
DBFolder As String
DBFn As String
End Type

A procedure in the module shows a form and I fill

appInfo
values, but when I unload the form the values are lost?

Why is that?

Jim





.



All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com