+ Reply to Thread
Results 1 to 2 of 2

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

  1. #1

    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


  2. #2
    Norman Jones
    Guest

    Re: 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



    <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1