Strip Visio diagrams out of a Word Document

M

MSPLearner

A word doc with lots of Visio diagrams is too large to send via email. Is
there a way to strip the diagrams (via a macro?), send the doc via email then
exit (w/o saving).
That way my client can get the doc (w/o diagrams) via email, then I would
send him the complete word doc (w/Diagram) on a CD via USPS.

MSPLearner
 
J

Jay Freedman

This macro *may* do the job. It depends on how the diagrams were
inserted in the document. If you press Alt+F9 and you see either an
EMBED field or a LINK field at the location of each diagram, then
you're good to go.

Sub DeleteVisioObjects()
Dim fld As Field
For Each fld In ActiveDocument.Fields
If InStr(LCase(fld.Code), "visio.drawing") > 0 Then
fld.Delete
End If
Next
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
J

Jean-Guy Marcil

MSPLearner was telling us:
MSPLearner nous racontait que :
A word doc with lots of Visio diagrams is too large to send via
email. Is there a way to strip the diagrams (via a macro?), send the
doc via email then exit (w/o saving).
That way my client can get the doc (w/o diagrams) via email, then I
would send him the complete word doc (w/Diagram) on a CD via USPS.

MSPLearner

Try this to strip and save as a new document:

'_______________________________________
Dim fldVisio As Field
Dim strPathDoc As String

strPathDoc = ActiveDocument.FullName
strPathDoc = Left(strPathDoc, Len(strPathDoc) - 4) & "_No-Visio.doc"

For Each fldVisio In ActiveDocument.Fields
If InStr(1, fldVisio.Code, "EMBED Visio") > 0 Then
fldVisio.Delete
End If
Next

ActiveDocument.SaveAs strPathDoc
'_______________________________________

As Jay wrote, you may want to do SHIFT-F9 on a Visio drawing to see the code
behind it to make sure that the code will pick it up.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top