Consulting

Results 1 to 4 of 4

Thread: hiding objects

  1. #1

    hiding objects

    Hello,

    I would like to know if its possible to hide controls on a word document? I have a document with some text boxes on them. The text boxes are from the control toolbox. I want to be able to hide the text boxes when the document is open, then when I click a button, I want to unhide the text boxes. Can that be done? Or only on a userform can you control the objects via code?

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Oh you can control things...however, there is no .Hide, nor .Visible. So, no, you can not hide a control.

    BUT, you can change the size. So have your Document_Open make the control small, and have your button change the height and width. Put the code in the ThisDocument module so you can use the Properties of the control directly.[vba]Option Explicit

    Private Sub Document_Open()
    TextBox1.Height = 1
    TextBox1.Width = 1
    End Sub

    Private Sub CommandButton1_Click()
    TextBox1.Height = 17.8
    TextBox1.Width = 72
    End Sub
    [/vba]

  3. #3
    Hi! Thanks alot!!! That worked perfectly.

  4. #4
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Good. Please mark the thread as Solved.

Posting Permissions

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