ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba for excel (https://www.excelbanter.com/excel-programming/285858-vba-excel.html)

Yehuda

vba for excel
 
How can I make subs in Userform modules be available in
standard modules?

I think it might have something to do with declaration,
but I have problems doing it.

Thanks for helping.

Yehuda

Tom Ogilvy

vba for excel
 
You need to put the subs in general modules and call them from the userform
module if you need to do this.

--
Regards,
Tom Ogilvy

"Yehuda" wrote in message
...
How can I make subs in Userform modules be available in
standard modules?

I think it might have something to do with declaration,
but I have problems doing it.

Thanks for helping.

Yehuda




keith

vba for excel
 
Access it with normal class notation.

Userform1.Subname

make sure nothing is private.

Keith
www.kjtfs.com


-----Original Message-----
How can I make subs in Userform modules be available in
standard modules?

I think it might have something to do with declaration,
but I have problems doing it.

Thanks for helping.

Yehuda
.


patrick molloy

vba for excel
 
To do this 'cleanly' not only should the procedure be
public, but the userform ought to be loaded into memory

Sub test()
Dim temp As UserForm1
Set temp = New UserForm1
Load temp
temp.helloworld

Unload temp
Set temp = Nothing
End Sub

Calling the procwill by default force open the userform

In general, place important subs in a standard module,
make sure that they're public , then you code in other
modules etc will be able to use them.
If you don't wanta public sub available to the macro list
on the workbook, then mark the module as

Option Private Module

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Access it with normal class notation.

Userform1.Subname

make sure nothing is private.

Keith
www.kjtfs.com


-----Original Message-----
How can I make subs in Userform modules be available in
standard modules?

I think it might have something to do with declaration,
but I have problems doing it.

Thanks for helping.

Yehuda
.

.



All times are GMT +1. The time now is 05:57 PM.

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