Sub DeleteImagesWithSpecificURL()
Dim iShape As InlineShape
Dim shp As Shape
Dim doc As Document
Dim searchURL As String
searchURL = "https://hoven.in/aspnet-core/asp-net-core-course-buy.html"
Set doc = ActiveDocument
' Check InlineShapes (images in the text flow)
For Each iShape In doc.InlineShapes
If iShape.Type = wdInlineShapePicture Then
If InStr(1, iShape.AlternativeText, searchURL, vbTextCompare) > 0 Then
iShape.Delete
End If
End If
Next iShape
' Check Shapes (floating images)
For Each shp In doc.Shapes
If shp.Type = msoPicture Then
If InStr(1, shp.AlternativeText, searchURL, vbTextCompare) > 0 Then
shp.Delete
End If
End If
Next shp
End Sub
Tuesday, December 24, 2024
VBA Word - Delete images from document with specific URL
The following VBA code deletes images from document with specific URL:
Subscribe to:
Post Comments (Atom)
Hot Topics
-
Objectives To provide detailed information about ListBox Types of ListBox Using ListBox in VBA applications Please read the post till end...
-
Main points about class Class is a template to create objects. Class is user defined data type. Class represents a business entity. Class is...
-
JavaScript was created in 1995 by a programmer named Brendan Eich for Netscape Communications Company. Brendan Eich worked in the same comp...
No comments:
Post a Comment