Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Deleting Controls (Word 97/2002)

    How do you delete a control, for example, a checkbox from a user form?

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Deleting Controls (Word 97/2002)

    I'm not sure that you can delete a control whilst your code is running, but you can set the Visible property of a control to False which may do what you need.

    StuartR

  3. #3
    2 Star Lounger
    Join Date
    Aug 2001
    Posts
    158
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Deleting Controls (Word 97/2002)

    Hi Stuart:

    I tried that approach and it kinda work but there's a little problem.

    I have 6 controls: 3 checkboxes, 2 command buttons (ok/cancel), and 1 label

    I used the Visible property to hide all the controls. Then I set the Label to be Visible and changed its caption.

    I also change the dialog Height to 50 from it's original size of 160.

    I added Repaint as well, BUT when I run the macro, it looks like there are 2 dialog boxes on the screen. The frist larger dialog box which is blank, then on top of it, the resized dialog box. I've tried adding Repaint in a few places but it's not working.

    BTW, At the very beginning of the code, I also have:
    'Word.Application.ScreenUpdating = False
    'System.Cursor = wdCursorWait

    When I removed these 2 lines, the dialob box showed up correctly.

  4. #4
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Deleting Controls (Word 97/2002)

    Try Application.ScreenRefresh just after you resize the userform

    StuartR

Posting Permissions

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