Sub ExtractFiles()
'
' ExtractFiles Macro
'
'
Dim shape As InlineShape
Dim folderName As String
Dim a As Document
folderName = Replace(ThisDocument.Name, ".", "_")
MkDir folderName
For Each shape In ThisDocument.InlineShapes
If (shape.Type = wdInlineShapeEmbeddedOLEObject) And
(InStr(LCase(shape.OLEFormat.IconLabel), ".doc") > 0) Then
shape.OLEFormat.Object.SaveAs (folderName & "\" &
shape.OLEFormat.IconLabel)
End If
Next shape
End Sub
Hope it helps.
--
Brian McCaffery
DeanH
Try
For Each shape In ThisDocument.InlineShapes
If shape.Type = wdInlineShapeEmbeddedOLEObject And _
InStr(LCase(shape.OLEFormat.IconLabel), ".doc") > 0 Then
shape.OLEFormat.Object.SaveAs (folderName & "\" & _
shape.OLEFormat.IconLabel)
End If
Next shape
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"DeanH" <De...@discussions.microsoft.com> wrote in message
news:47889C37-5858-4C48...@microsoft.com...
DeanH
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"DeanH" <De...@discussions.microsoft.com> wrote in message
news:91ABD0B3-9941-4C2C...@microsoft.com...
From the macro script I gather that the extracted files should go to the
same folder as the original document, and they are named as per the icon
display.
Any way, I have manually extractd the files I needed, but it would be nice
to get this working.
Many thanks for your perseverance.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"DeanH" <De...@discussions.microsoft.com> wrote in message
news:FE8FD360-F54A-43FE...@microsoft.com...
The following will however copy such objects to another document:
Dim Source As Document, Target As Document
Dim rngTarget As Range
Dim i As Long
Set Source = ActiveDocument
Set Target = Documents.Add
With Source
For i = .Fields.Count To 1 Step -1
If .Fields(i).Type = wdFieldEmbed Then
.Fields(i).Copy 'Use Cut instead of Copy if you want to remove
the files from the source
Set rngTarget = Target.Range
rngTarget.Collapse wdCollapseEnd
rngTarget.Paste
Target.Range.InsertAfter vbCr
End If
Next i
End With
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"DeanH" <De...@discussions.microsoft.com> wrote in message
news:BBFD8A7F-D53A-4076...@microsoft.com...
Dim Source As Document
Dim xlapp As Object
Dim xlbook As Object
Dim xlSheet As Object
Dim Excelwasnotrunning As Boolean
Dim i As Long
On Error Resume Next
Set xlapp = GetObject(, "Excel.Application")
If Err Then
Excelwasnotrunning = True
Set xlapp = CreateObject("Excel.Application")
End If
Set Source = ActiveDocument
With Source
For i = .Fields.Count To 1 Step -1
If .Fields(i).Type = wdFieldEmbed Then
.Fields(i).Copy 'Use Cut instead of Copy if you want to remove
the files from the source
With xlapp
Set xlbook = .Workbooks.Add
Set xlSheet = xlbook.Worksheets(1)
xlSheet.Paste
xlbook.SaveAs "Sheet" & i
xlbook.Close
End With
End If
Next i
End With
Set xlSheet = Nothing
Set xlbook = Nothing
If Excelwasnotrunning = True Then
xlapp.Quit
End If
Set xlapp = Nothing
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"DeanH" <De...@discussions.microsoft.com> wrote in message
news:B4C85E8E-E1E2-4CE2...@microsoft.com...