Results 1 to 3 of 3

Thread: Delete all paragraphs containing a particular image using a VBA macro in MS Word

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    20
    Rep Power
    0
    i have made this for text comparision you can compare with height,width and more. for comparing with your local machine image

    try this

    Code:
    Sub test()
    Dim pic As Shape, a As Shape, b As Shape
    ''''uses only 2 pics at a time
    For Each pic In ActiveSheet.Shapes
        If pic.Type = msoPicture Then
        
            If a Is Nothing Then
            Set a = pic
            ElseIf b Is Nothing Then
            Set b = pic
            End If
        
            
        End If
        
    Next pic
    ''''types of comparision
    ' a.Height
    ' a.Width
    ' a.AutoShapeType
    ' a.ID
    
    If a.AlternativeText = b.AlternativeText Then
    MsgBox "Caught Them"
    Exit Sub
    End If
    
    End Sub

    or use this for all pics comparing height and width


    Code:
    Sub test()
    Dim pic As Shape, a As Shape, b As Shape
    ''''for all the pics
    For Each pic In ActiveSheet.Shapes
        If pic.Type = msoPicture Then
            If pic.Height = 0 And pic.Width = 0 Then
            MsgBox "delete your row"
            Exit Sub
            End If
        End If
        
    Next pic
    
    End Sub
    Last edited by ashu1990; 09-11-2013 at 06:40 PM.

Similar Threads

  1. Replies: 7
    Last Post: 08-24-2015, 10:58 PM
  2. Macro to delete trailing X's
    By Howardc in forum Excel Help
    Replies: 2
    Last Post: 03-29-2013, 12:43 PM
  3. Replies: 1
    Last Post: 10-16-2012, 01:53 PM
  4. Replies: 4
    Last Post: 08-14-2012, 03:17 AM
  5. Adding Scroll bar to image box in vba
    By princ_wns in forum Excel Help
    Replies: 1
    Last Post: 12-13-2011, 09:47 PM

Posting Permissions

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