Go to the next paragraph with bullet

Discussion in 'Word VBA' started by hans.list@gmail.com, Nov 22, 2013.

  1. Guest


    Is it possible to go from the current cursor position in a document to the first paragraph of the next bulleted list (that makes the Bullet list item on the ribbon light)?


    , Nov 22, 2013
    1. Advertisements

  2. Guest

    This puts the cursor at the start of the first paragraph with a bullet:

    Dim myPar As Paragraph

    For Each myPar In ActiveDocument.Paragraphs

    If myPar.Range.ListFormat.ListType = wdListBullet Then
    End If

    Next myPar

    How can I make the macro remember the paragraph number, that is: if I start it again, it should go to the next bulleted range.
    , Nov 27, 2013
    1. Advertisements

  3. Obtain the number of paragraphs in the document.
    Set an initial paragraph variable to 0.
    Change the For Each to loop on an index ranging from initial paragraph
    variable to number of paragraphs.
    When the if is satisfied, save the current loop index +1 in the
    initial paragraph variable.
    Barry Schwarz, Nov 28, 2013
  4. Guest

    Thanks! How can I start the For each loop at a certain paragraph number?
    , Nov 28, 2013
  5. By definition, For Each will always start at the first paragraph.
    Otherwise, it would be For Some.

    Instead of For Each, loop on a paragraph index. You can set the
    starting and ending values of the index to any value you like,
    constant or computed.
    Barry Schwarz, Nov 28, 2013
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.