ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modules and Forms (https://www.excelbanter.com/excel-programming/281679-modules-forms.html)

PEdro

Modules and Forms
 
Hi,
I have a module that call a form using frmMain.Show
the form gets a value for a variable xxx=12 but whenever it turns to the
module (by doing frmMain.Hide) the xxx has no value
What change should I make to the code in order to have the variable.

Regards

Pedro



Chip Pearson

Modules and Forms
 
Pedro,

Where are you declaring the variable? If you declare it as a public
variable in a standard code module, outside of and before any procedure, it
will be available to all procedures in the project. E.g.,

Public X As Long


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




"Pedro" wrote in message
...
Hi,
I have a module that call a form using frmMain.Show
the form gets a value for a variable xxx=12 but whenever it turns to the
module (by doing frmMain.Hide) the xxx has no value
What change should I make to the code in order to have the variable.

Regards

Pedro





PEdro

Modules and Forms
 
Thanks Chip

I already declared as a public variable doing "Public strNoM As Variant".
Any reason why this happens?

regards
Pedro


"Chip Pearson" wrote in message
...
Pedro,

Where are you declaring the variable? If you declare it as a public
variable in a standard code module, outside of and before any procedure,

it
will be available to all procedures in the project. E.g.,

Public X As Long


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




"Pedro" wrote in message
...
Hi,
I have a module that call a form using frmMain.Show
the form gets a value for a variable xxx=12 but whenever it turns to the
module (by doing frmMain.Hide) the xxx has no value
What change should I make to the code in order to have the variable.

Regards

Pedro








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

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