Word cannot have TextBox1.visible = false???

  • Hi guys, im trying to do the reallly simple task of setting some textboxes to visible = false, but word is hating it!

    It just dosnt seem to be an option in word 2002

    Can anyone help?

    Many thanks. :thanx: :thanx:

  • Re: Word cannot have TextBox1.visible = false???


    Bit short on details. Where is this textbox in relation to the document? Is it an active-x control on the document, or maybe a formfield or perhaps a userform textbox?

    Can you post an example file, which might clarify things?


  • Re: Word cannot have TextBox1.visible = false???


    Its just a VB control, a textbox

    I've attached a file, but added a command button to click

    In VB, it would just be: "TextBox1.Visible = False"

    But in vba in word that doesnt work. It works fine in excel, but not word.

    (Attached Word doc)

    Thanks for your help.


  • Re: Word cannot have TextBox1.visible = false???


    The controls do not appear to have a Visible property. Go to design mode and select either the textbox or commandbutton. If you display the properties window Visible is not listed.

    How about using the Enabled property instead?


  • Re: Word cannot have TextBox1.visible = false???

    No, enabled is no good.

    If the .visible is available in excel, why not word?

    Im sure someone will give a solution.

    Thanks again.

  • Re: Word cannot have TextBox1.visible = false???

    Try this code below
    You can not really make the box disappear, unless you wrote code to erase it, but this will allow it to stay out of your way. At most, the tab key would take you to it, but you wouldn't be able to type in it. A mouse click on it would also put the cursor there, but again you wouldn't be able to type in it

  • Re: Word cannot have TextBox1.visible = false???

    Another quick example:

    Sometimes you want the box to be visible and sometimes you don't.
    For instance, in the example below, when the user selects "Other" in a ComboBox1, then TextBox1 becomes visible. The user can also go back and select something else in ComboBox1, and TextBox1 will disappear.

  • Re: Word cannot have TextBox1.visible = false???

    Thanks for all your help everyone!

    What i was basicly trying to do was have a textbox visible, then hide it soon as the document loaded.

    That way, if macros were disabled, the user would see the textbox with instructions on how to turn macros on. Once this was done, the code to hide the textbox would be able to run, and it wouldnt be seen.

    Cheers all. :thanx:

  • Ok so i had the exact same issue never coded in my life, but this worked for me.

    Hope this helps

    Private Sub CheckBox4_Change()

    'If user selects "Other" then TextBox4 becomes visible on the screen.

    'It is intended that the user type in what corresponds to "Other" item in TextBox4

    If CheckBox4.Value = "True" Then '"Other" is one of the selections from a drop

    'down list present when clicking on CommandButton1

    TextBox4.Value = "Please type in" 'instructs user to type in TextBox4

    TextBox4.BackColor = &H80FFFF 'Highlights TextBox4 in yellow to alert

    'user to type in it - this is optional code

    TextBox4.SpecialEffect = 1 'makes TextBox4 appear sunken into screen

    TextBox4.BorderStyle = 1 'Puts single line border around TextBox4

    TextBox4.Locked = False 'unlocks TextBox4, which is usually locked,

    'so user can type in it.

    Else 'If user selects a selection other than "Other",

    'or changed their mind after typing in text.

    TextBox4.Value = "" 'Gets rid of any text the user may have

    'typed in TextBox4

    TextBox4.BackColor = &HFFFFFF 'Returns box to white color to make it

    'blend back into white page

    TextBox4.SpecialEffect = 0 'flat, not sunken in

    TextBox4.BorderStyle = 0 'Gets rid of Single Line border around TextBox4

    TextBox4.Locked = True 'Locks TextBox4, to prevent user from typing in it

    End If

    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!