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

    User Forms (Word 97/2002)

    Is there a way to disable the X (close the dialog) on a user form?

    Also, is it possible to create a progress indicator like "The files is processing . . . " with 1 percent incrementing until it reaches 100%. I would like to add a dialog box to show the user what the macro is doing.

    FYI, I already have 1 user form, I can't get two of them working <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: User Forms (Word 97/2002)

    1. This code is from John Walkenbach:

    Private Sub UserForm_QueryClose _
    (Cancel As Integer, CloseMode As Integer)
    ' Prevents use of the Close button
    If CloseMode = vbFormControlMenu Then
    MsgBox "Clicking the Close button does not work."
    Cancel = True
    End If
    End Sub

    2. John also has an example of creating a progress indicator, with a downloadable demo. See Displaying a Progress Indicator. The same code is available in <!mskb=211736>Microsoft Knowledge Base Article 211736<!/mskb>.

    Chip Pearson has a different approach: he has created a DLL that you can use; it has to be installed and registered on every PC that uses the progress indicator. See Downloads and look for ProgressReporter.

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

    Re: User Forms (Word 97/2002)

    Hi Hans:

    Do you have any example using 2 user forms? LOL.

    The first user form, where the user will click on OK button, does the search and replace procedure, the one you helped me with, remember that? I don't know how to show another dialog box during the search and replace procedure [img]/forums/images/smilies/smile.gif[/img]

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: User Forms (Word 97/2002)

    The subject line says Word 97/2002. There is an important difference: userforms in Office 97 are always modal; that means that the code that opens a userform waits until the user closes the userform. This makes a second userform useless as a progress indicator, unless you run the code whose progress is to be followed from the second form. In Office 2000 and higher, the Show method of a userform has a Modal argument that can be True or False. If you want your code to be used in both versions, you must write it for Word 97. This means that the progress indicator must be on the same form as the code that performs the search and replace.

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

    Re: User Forms (Word 97/2002)

    Yes, I am running this on Word 97.

    I do not understand what you meant by "the progress indicator must be on the same form as the code that performs the search and replace." I currently have 1 module and 1 user form so that the user can select what to search and replace. When the user clicks on the OK button, the procedure starts. I use dialog hide to hide the first user form. When I created the second dialog box and called used MyDlgWait.Show, it showed the dialog box but did not do anything else.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: User Forms (Word 97/2002)

    Did you use any of the code from the links I posted, or is MyDlgWait a standard userform? If the latter, all code started from the first user form will pause until MyDlg is closed.

Posting Permissions

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