Results 1 to 5 of 5

Thread: listing bitmaps

  1. #1
    New Lounger
    Join Date
    Jan 2001
    Location
    UK, Cambridgeshire, England
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    listing bitmaps

    Word97, WindowsNT.

    I used linked bitmaps and Visio drawings in my documents. I would like to list the files used (in a text file). I can see the files in Edit > Links, but am not clever enough with macros to extract that list.

    I have tried writing a macro which finds occurrences of INSERTPICTURE and INSERTOBJECT and writes them to a file - and failed dismally!

    Any caring souls out there?

    TIA

    ChrisP

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: listing bitmaps

    Perhaps this will get you started. It is only finding IncludePicture but you get the idea.
    <pre>Dim aLink As Variant, sLinks As String
    For Each aLink In ActiveDocument.Fields
    If aLink.Type = 67 Then
    sLinks = sLinks & aLink & vbCr
    End If
    Next aLink
    MsgBox sLinks</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    New Lounger
    Join Date
    Jan 2001
    Location
    UK, Cambridgeshire, England
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: listing bitmaps

    Many thanks.

    But inevitably, but... I can see that '67' is 'code'(?) for INCLUDEPICTURE but I have been unable to find the list that includes that code in the help files.

    Since I also need the INCLUDEOBJECT 'code', can you either tell me or, preferably, point me towards it.

    Again, thanks for your time,

    ChrisP
    Macrofumbler Extrordinaire!

  4. #4
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: listing bitmaps

    Well ChrisP, With mind to the "Teach a man to fish" proverb this is how to solve it.
    Modify the code to give you the answer and step through the macro to see what happens.
    <pre>Sub temp4()
    Dim aLink As Variant, sLinks As String
    For Each aLink In ActiveDocument.Fields
    If aLink.Type = 67 Then
    sLinks = sLinks & aLink & vbCr
    Else
    MsgBox aLink.Type
    End If
    Next aLink
    MsgBox sLinks
    End Sub</pre>

    Now you can set up the macro to include both the number I already gave you and the number you just worked out. I have modified the code so you can add other magic numbers in the future without adding new lines. Alternatively you could use separate Case statements to build separate strings for the different types and then display them in groups.
    <pre>Sub temp4()
    Dim aLink As Variant, sLinks As String
    For Each aLink In ActiveDocument.Fields
    Select Case aLink.Type
    Case 58,67
    sLinks = sLinks & aLink & vbCr
    End Select
    Next aLink
    MsgBox sLinks
    End Sub</pre>

    Andrew Lockton, Chrysalis Design, Melbourne Australia

  5. #5
    New Lounger
    Join Date
    Jan 2001
    Location
    UK, Cambridgeshire, England
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: listing bitmaps

    Andrew, (insert enlightenment smilie) and thank you. I'm off to fish for some links.

    ChrisP

Posting Permissions

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