
Originally Posted by
xlnitwit
I fear you have not posted sufficient code to answer your first question. Nowhere have you indicated how or where you have implemented any property.
Ok, this is improvement:
Module:
Sub Wniosek()
Dim Moja As New MyForm
UserForm1.Login = Moja.Login()
UserForm1.Show
Class MyForm:
Function Login() As Variant
Login = Environ("USERNAME")
End Function
Userform1:
Public Login As String
Private Sub UserForm_Activate()
Dim W As Long
Dim numer As String
W = A_Wniosek.Range("A1").CurrentRegion.Rows.Count
numer = Me.Login & "_" & Format(W, "000000")
Label_Numer_zgloszenia = numer
Call Send_Mail
End Sub
So 2 problems:
Do once time function Login to pass it to Userform and to other Sub (to Send_Email Sub for example) in other modules.
What do you mean by rewriting function to do static variable ? What is it ?
Best Regards,
Jacek Antek
Bookmarks