Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded files?
Many thanks
DeanH
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Brian Brian is offline
external usenet poster
 
Posts: 298
Default Bulk Extract Embedded Files

Found the following for extracting embedded word files. Haven't tried it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded files?
Many thanks
DeanH

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't tried it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded files?
Many thanks
DeanH

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't tried it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded
files?
Many thanks
DeanH


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

Doug, thanks for the input. The macro does not fail now, but it also does not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't tried it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded
files?
Many thanks
DeanH




  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded
files?
Many thanks
DeanH


  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded
files?
Many thanks
DeanH


  #8   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new documents for
testing, as well as the document that I wanted this macro for in the first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded
files?
Many thanks
DeanH

  #9   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new documents for
testing, as well as the document that I wanted this macro for in the first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for embedded
files?
Many thanks
DeanH

  #10   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

If you toggle on the display of field codes (Alt+F9) in the document that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new documents
for
testing, as well as the document that I wanted this macro for in the first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH



  #11   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

If you toggle on the display of field codes (Alt+F9) in the document that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new documents
for
testing, as well as the document that I wanted this macro for in the first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

  #12   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

In the specific document that started all this, for one of the files I see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new documents
for
testing, as well as the document that I wanted this macro for in the first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

  #13   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files


In the specific document that started all this, for one of the files I see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new documents
for
testing, as well as the document that I wanted this macro for in the first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

  #14   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

The code that Brian gave you was not appropriate for Embedded object.

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" wrote in message
...
In the specific document that started all this, for one of the files I see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document
that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new
documents
for
testing, as well as the document that I wanted this macro for in the
first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

  #15   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

The code that Brian gave you was not appropriate for Embedded object.

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" wrote in message
...
In the specific document that started all this, for one of the files I see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document
that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new
documents
for
testing, as well as the document that I wanted this macro for in the
first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH



  #16   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

Doug.
Thanks for that, but I don't want to transfer the embedded files into
another Word document, I want to extract them to their native format in the
folder where the original Word resides.

DeanH


"Doug Robbins - Word MVP" wrote:

The code that Brian gave you was not appropriate for Embedded object.

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" wrote in message
...
In the specific document that started all this, for one of the files I see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document
that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new
documents
for
testing, as well as the document that I wanted this macro for in the
first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

  #17   Report Post  
Posted to microsoft.public.word.docmanagement
DeanH DeanH is offline
external usenet poster
 
Posts: 1,862
Default Bulk Extract Embedded Files

Doug.
Thanks for that, but I don't want to transfer the embedded files into
another Word document, I want to extract them to their native format in the
folder where the original Word resides.

DeanH


"Doug Robbins - Word MVP" wrote:

The code that Brian gave you was not appropriate for Embedded object.

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" wrote in message
...
In the specific document that started all this, for one of the files I see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document
that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new
documents
for
testing, as well as the document that I wanted this macro for in the
first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it also
does
not
do the extraction.
I have done several tests with several different files, in different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files. Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

  #18   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

You cannot tell from the Embed field, what the filename was, so you are
going to have to supply it, or as in the following code, just have the files
named with a name such as Sheet & i where i is the field counter that is
being used:

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" wrote in message
...
Doug.
Thanks for that, but I don't want to transfer the embedded files into
another Word document, I want to extract them to their native format in
the
folder where the original Word resides.

DeanH


"Doug Robbins - Word MVP" wrote:

The code that Brian gave you was not appropriate for Embedded object.

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" wrote in message
...
In the specific document that started all this, for one of the files I
see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document
that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new
documents
for
testing, as well as the document that I wanted this macro for in the
first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it
also
does
not
do the extraction.
I have done several tests with several different files, in
different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files.
Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

  #19   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Bulk Extract Embedded Files

You cannot tell from the Embed field, what the filename was, so you are
going to have to supply it, or as in the following code, just have the files
named with a name such as Sheet & i where i is the field counter that is
being used:

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" wrote in message
...
Doug.
Thanks for that, but I don't want to transfer the embedded files into
another Word document, I want to extract them to their native format in
the
folder where the original Word resides.

DeanH


"Doug Robbins - Word MVP" wrote:

The code that Brian gave you was not appropriate for Embedded object.

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" wrote in message
...
In the specific document that started all this, for one of the files I
see
{EMBED Excel.sheet.12}
DeanH


"Doug Robbins - Word MVP" wrote:

If you toggle on the display of field codes (Alt+F9) in the document
that
contains the embedded files, what do you see?



--
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" wrote in message
...
Doug.
All the embedded file are InLine.
It appears that nothing is happening when the macro is run.
What I have checked is the following.
Run macro.
No new documents appear in the folder of the original file.
No new documents are created in the drive.
Now search turns up any file with the names of the embedded files.
I have done several tests with some old documents of mine, new
documents
for
testing, as well as the document that I wanted this macro for in the
first
place, no extraction happens.

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.
DeanH


"Doug Robbins - Word MVP" wrote:

Exactly what is it that you have in the document? That macro is
specifically for in-line shapes.

--
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" wrote in message
...
Doug, thanks for the input. The macro does not fail now, but it
also
does
not
do the extraction.
I have done several tests with several different files, in
different
locations, but no extraction happens :-(

DeanH


"Doug Robbins - Word MVP" wrote:

Probably caused by line breaks inserted by the mail program.

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" wrote in message
...
Brian, thanks but sorry, it fails at the "End If".
"Compile error: End If without block If"

DeanH


"Brian" wrote:

Found the following for extracting embedded word files.
Haven't
tried
it
though.

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" wrote:

Word 2003 on XP
Is there a way to extract embedded files all in one go?
Like the image file extraction process described in
http://www.gmayor.com/extract_images_from_word.htm but for
embedded
files?
Many thanks
DeanH

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I extract an embedded object in a Word document Rob M[_2_] Microsoft Word Help 0 June 10th 09 06:15 PM
Bulk conversion of Word Perfect files Roppen Microsoft Word Help 9 October 20th 08 02:53 PM
Want to open and bulk convert Word 2 files Alexa McLaughlin Microsoft Word Help 4 May 24th 08 09:53 AM
How do i extract embedded objects from a word doc? savs Microsoft Word Help 1 November 5th 07 08:26 PM
Convert embedded images in bulk Hugh Barker Microsoft Word Help 1 June 7th 06 11:11 AM


All times are GMT +1. The time now is 01:44 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"