ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to set a userform's button caption equal to a variable in the main procedure? (https://www.excelbanter.com/excel-programming/370158-how-set-userforms-button-caption-equal-variable-main-procedure.html)

[email protected]

how to set a userform's button caption equal to a variable in the main procedure?
 
Hello--does anyone know how to set the caption on a command button of a
userform equal to a variable generated in a main procedure (in which
the userform procedure is loaded and displayed). Thanks, Abe


Norman Jones

how to set a userform's button caption equal to a variable in the main procedure?
 
Hi Akh,

In a standard module, before any code, paste the fillowing code:

'=============
Option Explicit
Public strCaption As String

'---------------

Public Sub Tester()
strCaption = "Your Caption"
UserForm1.Show
End Sub
'<<=============

In the useform module, try:
'=============
Private Sub UserForm_Initialize()
Me.CommandButton1.Caption = strCaption
End Sub
'<<=============


---
Regards,
Norman



wrote in message
oups.com...
Hello--does anyone know how to set the caption on a command button of a
userform equal to a variable generated in a main procedure (in which
the userform procedure is loaded and displayed). Thanks, Abe





All times are GMT +1. The time now is 12:37 PM.

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