locked
Word chart send behind text RRS feed

  • Question

  • hello guys, is there a way to set a chart in word via vba, to send the chart behind text?

    thanks.


    Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.

    Tuesday, September 19, 2017 10:51 PM

Answers

  • Hello,

    If you have a chart copied from Excel chart, then you could use the following code to set it behind text.

    Dim sh As Shape
    Set sh = ActiveDocument.Shapes(1)
    sh.WrapFormat.Type = wdWrapBehind

    If the chart is created in Word, you could use the following code

    Dim inlineSh As InlineShape
    Set inlineSh = ActiveDocument.InlineShapes(1)
    inlineSh.ConvertToShape.WrapFormat.Type = wdWrapBehind

    The difference is that the chart would be Shape if you paste from Excel and would be InlineShape if you create it in Word.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by cguan Saturday, September 23, 2017 4:14 AM
    Wednesday, September 20, 2017 2:12 AM

All replies

  • Hello,

    If you have a chart copied from Excel chart, then you could use the following code to set it behind text.

    Dim sh As Shape
    Set sh = ActiveDocument.Shapes(1)
    sh.WrapFormat.Type = wdWrapBehind

    If the chart is created in Word, you could use the following code

    Dim inlineSh As InlineShape
    Set inlineSh = ActiveDocument.InlineShapes(1)
    inlineSh.ConvertToShape.WrapFormat.Type = wdWrapBehind

    The difference is that the chart would be Shape if you paste from Excel and would be InlineShape if you create it in Word.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by cguan Saturday, September 23, 2017 4:14 AM
    Wednesday, September 20, 2017 2:12 AM
  • Thanks.

    Every second counts..make use of it. Disclaimer: This posting is provided AS IS with no warranties or guarantees and confers no rights.

    Saturday, September 23, 2017 4:14 AM