'Method 1 - Store the text to pass in a document variable.ĪctiveDocument.Variables("txtPassedToForm").Value = fcnCaptionText(2) Userform custom properties with data variables declared privately in the userform class module.Ī userform displays data received from the calling macro and the interface to collect data for passing data back to the calling procedure.Userform custom properties with data variables declared publically in the userform class module.Define document variables where the calling procedure writes to a variable, the userform reads the variable, the userform writes to a variable, and finally the calling procedure reads the variable.You can encapsulate and avoid exposing your userform controls to external procedures by using one of the following four methods: For more on the importance of encapsulating userform code, see: UserForm – Advanced Notes & Tips. The drawback is that the form's controls are not encapsulated and are exposed to external procedures. One of my early Senseis called this simple method the "Look Ma, no public variables method." There are no "Public" declared variables used to pass data to and from the calling procedure, the userform or other external processing procedures. Textbox1.Text) can be evaluate directly in the calling procedure. Since the userform is still loaded in memory, its properties (i.e. In the calling procedure the data entered in the userform is returned using a simple VBA MsgBox function. When the user enters a valid size the cmdOK_Click procedure runs to termination and control is returned to the calling procedure. Function fcnSizeValidator(strSize As String) As Boolean
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |