Results 1 to 4 of 4

Thread: How to stop for loop until the userform complete the first task?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2012
    Posts
    22

    Post How to stop for loop until the userform complete the first task?

    In my process, I Use some conditions. For every paragraphs I want to change based on the conditions. Conditions are applied using Userform in vba using (Click OK event). Here i gave the code
    Code:
    Dim Referencecount as integer 
    Dim i as integer
    Dim Authorreference() as string
    Selection.MoveRight unit:=wdCharacter, count:=1
    For i = 1 To referencecount
    Selection.MoveDown unit:=wdParagraph, count:=1, Extend:=wdExtend
    Selection.Range.HighlightColorIndex = wdTurquoise
    Authorreference(i) = Selection.Range.text
    UserForm1.Show
    Next i
    Please Guide me How to stop the For loop until the userform complete the first task. Many thanks in advance

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: How to stop for loop until the userform complete the first task?

    open it vbmodal - but will need to be closed/hidden for the code to continue.



    I think it is:
    Code:
    UserForm1.Show vbmodal
    But the f1 help on .Show should tell you

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How to stop for loop until the userform complete the first task?

    Cross posted at

    http://stackoverflow.com/questions/1...the-first-task

    I am still waiting for your reply there
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Mar 2012
    Posts
    22

    Re: How to stop for loop until the userform complete the first task?

    Quote Originally Posted by Deepakgopikannan View Post
    In my process, I Use some conditions. For every paragraphs I want to change based on the conditions. Conditions are applied using Userform in vba using (Click OK event). Here i gave the code
    Code:
    Dim Referencecount as integer 
    Dim i as integer
    Dim Authorreference() as string
    Selection.MoveRight unit:=wdCharacter, count:=1
    For i = 1 To referencecount
    Selection.MoveDown unit:=wdParagraph, count:=1, Extend:=wdExtend
    Selection.Range.HighlightColorIndex = wdTurquoise
    Authorreference(i) = Selection.Range.text
    UserForm1.Show
    Next i
    Please Guide me How to stop the For loop until the userform complete the first task. Many thanks in advance
    After processed the first string the userform1 had to set nothing (Set userform1 = Nothing) and have to referesh the userform1.I hope this will correct

    Code:
    Set userform1 = Nothing
    Code:
    Public Sub Refereshchkbox()
    CheckBox1.Value = False
    CheckBox1.Enabled = True
    CheckBox2.Value = False
    CheckBox2.Enabled = True
    End sub

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width