Hi all
I have a very strange problem with InlineShapes. In my document if there is a canvas before any wordart inlineshape, and i try to get a reference of this shape it give me a error. My objective is to change the text of all wordart shapes.
I am using ms word2003 and vb.net for automation
here is my code
The above code works well if there is no Canvas before word art. But if in my document i have a drawing canvas before wordart i got error on last line, i do not why? And even more strange thing is if I have also another canvas after the wordart the code wdocs.InlineShapes.Count return me zero. Please help me, I need to resolve it very urgently.
Thanks and regards
Atif
I have a very strange problem with InlineShapes. In my document if there is a canvas before any wordart inlineshape, and i try to get a reference of this shape it give me a error. My objective is to change the text of all wordart shapes.
I am using ms word2003 and vb.net for automation
here is my code
Code:
Dim wapp As Word.Application
Dim wdoc As Word.Document
Dim i As Integer
wapp = GetObject(, "word.application")
wdoc = wapp.ActiveDocument
this works perfectly
MsgBox(wdoc.InlineShapes.Count)
it also works well, BUT IF IN DOCUMENT THERE IS ANY CANVAS BEFORE WORDART
it throughs exception "System.Runtime.InteropServices.COMException" and
more interestingly if there is another Canvas after wordart the MsgBox(wdoc.InlineShapes.Count) returns zero
MsgBox(wdoc.InlineShapes(1).TextEffect.Text)
The above code works well if there is no Canvas before word art. But if in my document i have a drawing canvas before wordart i got error on last line, i do not why? And even more strange thing is if I have also another canvas after the wordart the code wdocs.InlineShapes.Count return me zero. Please help me, I need to resolve it very urgently.
Thanks and regards
Atif