Try this
Code:
Sub GetPicturesFromWordDocument()
Dim strFile As String
Dim strFileType As String
Dim strPath As String
Dim lngLoop As Long
Dim strOriginalFile As String
Dim strDocumentName As String
strOriginalFile = ActiveDocument.FullName
strDocumentName = Left(ActiveDocument.Name, InStrRev(ActiveDocument.Name, ".") - 1)
strPath = ActiveDocument.Path
ActiveDocument.SaveAs strPath & "\" & strDocumentName, wdFormatHTML, , , , , True
strFileType = "*.png;*.jpeg;*.jpg;*.bmp" 'Split with semi-colon if you want to specify more file types.
MkDir strPath & "\MovedToHere"
For lngLoop = LBound(Split(strFileType, ";")) To UBound(Split(strFileType, ";"))
strFile = Dir(strPath & "\" & strDocumentName & "_files\" & Split(strFileType, ";")(lngLoop))
Do While strFile <> ""
Name strPath & "\" & strDocumentName & "_files\" & strFile As strPath & "\MovedToHere\" & "New " & strFile
strFile = Dir
Loop
Next lngLoop
ActiveDocument.Close 0
Documents.Open strOriginalFile
Kill strPath & "\" & strDocumentName & ".htm*"
Kill strPath & "\" & strDocumentName & "_files\*.*"
RmDir strPath & "\" & strDocumentName & "_files"
strFile = vbNullString
strFileType = vbNullString
strPath = vbNullString
lngLoop = Empty
End Sub
Bookmarks