Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  • Thread Tools
  1. Lounger
    Join Date
    Mar 2009
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Stuart,

    Thank you soooo much for your help.......its working now.

    One more thing I need to add in userform:

    Whenever I open the document, userform pops up and the text boxes are blank.

    Is it possible that textboxes retains the value i have entered earlier, if i need to edit the values then i can otherwise no need to enter the values again and again.





    [quote name='StuartR' post='769009' date='03-Apr-2009 16:32']You really are going to have to post your template so we can see what you have done.[/quote]

  2. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts
    You can use code in the Initialize event of the userform:

    Code:
    Private Sub UserForm_Initialize()
      With ActiveDocument
    	TextBox1.Value = .Bookmarks("product_name").Range.Text
    	TextBox2.Value = .Bookmarks("doc_number").Range.Text
      End With
    End Sub

  3. Lounger
    Join Date
    Mar 2009
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Hans,

    Thanks alot.......great help

    one more issue.......... when i open the document,userform pops up but anyone can bypass it justby clicking the close button.

    is it possible to deactivate the close button?





    [quote name='HansV' post='769680' date='08-Apr-2009 17:06']You can use code in the Initialize event of the userform:

    Code:
    Private Sub UserForm_Initialize()
      With ActiveDocument
    	TextBox1.Value = .Bookmarks("product_name").Range.Text
    	TextBox2.Value = .Bookmarks("doc_number").Range.Text
      End With
    End Sub
    [/quote]

  4. Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 10 Times in 10 Posts
    You can add the following code to the userform's code module:

    Code:
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
      ' Disable use of the Close button in the upper right corner
      If CloseMode = vbFormControlMenu Then
    	Beep
    	Cancel = True
      End If
    End Sub
    Note: you *must* provide a command button on the userform that unloads it, otherwise the user won't be able to close the userform at all!

  5. Lounger
    Join Date
    Mar 2009
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah..... right )

    Thanks to all for helping me out.

    its becoz of you all I was able to create that userform.

    Thanks alot once again.


    Best Wishes



    [quote name='HansV' post='769852' date='09-Apr-2009 15:56']You can add the following code to the userform's code module:

    Code:
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
      ' Disable use of the Close button in the upper right corner
      If CloseMode = vbFormControlMenu Then
    	Beep
    	Cancel = True
      End If
    End Sub
    Note: you *must* provide a command button on the userform that unloads it, otherwise the user won't be able to close the userform at all! [/quote]

Page 2 of 2 FirstFirst 12

Posting Permissions

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