Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Strip Visio diagrams out of a Word Document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MSPLearner - 25 Oct 2006 21:03 GMT
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
Jay Freedman - 26 Oct 2006 03:07 GMT
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        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>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
[quoted text clipped - 3 lines]
>
>MSPLearner
MSPLearner - 26 Oct 2006 19:43 GMT
Thank you for the response, I will check out the macro.

MSPLearner

> 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
[quoted text clipped - 24 lines]
> >
> >MSPLearner
Jean-Guy Marcil - 26 Oct 2006 04:48 GMT
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
[quoted text clipped - 3 lines]
>
> 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.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.