Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2007
    Massachusetts, USA
    Thanked 0 Times in 0 Posts

    Generate a figure title list globally (MS Word 200

    <P ID="edit" class=small>(Edited by jscher2000 on 07-Aug-08 11:26. Added [pre] and [/pre] markup around code to make it more readable.)</P>Hello all,

    Currently, I have the following code that allows me to generate a list of figures (INCLUDEPICTURE) - after opening up each chapter.

    Now, I would like to modify the code to generate just the list of Figure Titles.

    Would I modify only the line of code listed at the bottom of the macro?

    ************************************************** ***********************************************

    <pre>Sub ListOfIncludePicturePaths()
    Dim docExisting As Word.Document, fld As Word.Field, _
    docNew As Word.Document, strTemp() As String
    Set docExisting = ActiveDocument
    With docExisting
    If .Fields.Count > 0 Then
    For Each fld In .Fields
    If fld.Type = wdFieldIncludePicture Then
    If (docNew Is Nothing) Then Set docNew = Documents.Add
    strTemp = Split(fld.Code, """")
    docNew.Content.InsertAfter strTemp(1) & vbCrLf
    End If
    End If
    End With
    If Not (docNew Is Nothing) Then
    Set docNew = Nothing
    End If
    Set docExisting = Nothing
    End Sub</pre>

    ************************************************** ***********************************************

    If fld.Type = Figure {SEQ Figure * ARABIC }. ABC Computer. Then

    Thanks in advance for your assistance.



  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: Generate a figure title list globally (MS Word

    <P ID="edit" class=small>(Edited by jscher2000 on 07-Aug-08 11:46. )</P>You can learn the "wd" constants for different types of fields using product help (select the property Type and press F1) or the Object Browser (press F2).

    If that does not help, you can select the field code in your document, then run this little procedure:

    <code>Sub SniffField()
    Dim fld As Word.Field
    Set fld = Selection.Fields(1)
    Stop ' Examine properties of fld object using View > Locals
    Set fld = Nothing
    End Sub</code>

    I use this "sniffing" method all the time to examine all kinds of objects in Office and better understand their properties and what other types of objects they allow you to access. You just need to customize it to open the exact kind of object you want to examine.

    Added: To complete the procedure after it stops, press F5 or use the forward triangle button on the Debug toolbar.

Posting Permissions

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