Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jan 2007
    Location
    Massachusetts, USA
    Posts
    272
    Thanks
    3
    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
    Next
    End If
    End With
    If Not (docNew Is Nothing) Then
    docNew.Activate
    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.

    Regards,

    Jim

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 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
  •