none
How can I remove all the drawing canvases from a Word file? RRS feed

  • Question

  • Hi,

    There are many drawing canvases in the document, which were created by pressing 'edit' on embedded EMF files.

    Since all of these need to be replaced, I have searched for a way to delete all the drawing canvases. But I couldn't find the solution.

    Is there a macro that will delete all the drawing canvases in the document? Or, is the drawing canvas defined as an object type at all?

    Thanks in advance.

     

    • Edited by Felipe Ha Friday, July 17, 2015 7:39 AM
    Friday, July 17, 2015 7:38 AM

Answers

  • Hi,

    >>Is there a macro that will delete all the drawing canvases in the document?

    you may delete all the canvas referring the below code

    Sub DeleteCanvas()
    Dim shapes As shapes
    Dim sh As Shape
    Set shapes = ActiveDocument.shapes
    For Each sh In shapes
    If sh.Type = msoCanvas Then
    sh.Delete
    End If
    Next sh
    End Sub

    Hope this could help you.

    Best Regards,

    Lan


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by L.HlModerator Wednesday, July 29, 2015 9:08 AM
    Monday, July 20, 2015 8:21 AM
    Moderator

All replies

  • Hi Felipe

    It's not something I've ever tried, but theoretically you should be able to loop all the Shape objects in the various document StoryRanges, check the Type property whether it's MsoShapeType.msoCanvas...


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 17, 2015 4:13 PM
    Moderator
  • Hi,

    >>Is there a macro that will delete all the drawing canvases in the document?

    you may delete all the canvas referring the below code

    Sub DeleteCanvas()
    Dim shapes As shapes
    Dim sh As Shape
    Set shapes = ActiveDocument.shapes
    For Each sh In shapes
    If sh.Type = msoCanvas Then
    sh.Delete
    End If
    Next sh
    End Sub

    Hope this could help you.

    Best Regards,

    Lan


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by L.HlModerator Wednesday, July 29, 2015 9:08 AM
    Monday, July 20, 2015 8:21 AM
    Moderator