Shapes function

B

bhims

hi,
i am migrating an application from word 2000 to word 2007. during the
process i am facing trouble using shapes command.
the application is supposed to identify lines and store it in other
location.
the code i am using is:
doc.Application.Selection.WholeStory()
int_wordcount = doc.Application.Selection.Words.Count
doc.Application.Selection.HomeKey(Unit:=Word.WdUnits.wdStory)
For Each wline In doc.Shapes
If wline.Type = 9 Then ' Check for picture type as line
wline.Select()
..............
its working fine with word 2000, but in word 2007 its reading alternate
lines; as in it would detect 1st and 3rd line and leave 2nd and 4th.
i am unable to understand why is it happening.
can some1 pls help.
thanks
 
L

Lene Fredborg

Lines and other drawing object can be inserted in line with text, i.e. in the
text layer of the document – they are _InlineShapes_. Drawing objects with
any other wrapping style are _Shapes_. Have you checked the wrapping style of
your lines? Maybe the lines that are not found by your code are “in line with
textâ€.

To check the wrapping style of a line, right-click the line and select
“Format [object]â€. You will find the wrapping style on the Layout tab of the
dialog box that opens.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
B

bhims

Hi Lene,
thanks for the reply, i checked out the lines. their wrapping styles are
"in-front of-text". so we can rule that option also.
i am unable to understand why this code is working fine with word 2000 then.
only things i changed for 2007 were importing Microsoft.Office.Interop and
Microsoft.Office.Core. rest i believe should work same. is there any specific
function or method i need to use along with d shapes function..

Lene Fredborg said:
Lines and other drawing object can be inserted in line with text, i.e. in the
text layer of the document – they are _InlineShapes_. Drawing objects with
any other wrapping style are _Shapes_. Have you checked the wrapping style of
your lines? Maybe the lines that are not found by your code are “in line with
textâ€.

To check the wrapping style of a line, right-click the line and select
“Format [object]â€. You will find the wrapping style on the Layout tab of the
dialog box that opens.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


bhims said:
hi,
i am migrating an application from word 2000 to word 2007. during the
process i am facing trouble using shapes command.
the application is supposed to identify lines and store it in other
location.
the code i am using is:
doc.Application.Selection.WholeStory()
int_wordcount = doc.Application.Selection.Words.Count
doc.Application.Selection.HomeKey(Unit:=Word.WdUnits.wdStory)
For Each wline In doc.Shapes
If wline.Type = 9 Then ' Check for picture type as line
wline.Select()
..............
its working fine with word 2000, but in word 2007 its reading alternate
lines; as in it would detect 1st and 3rd line and leave 2nd and 4th.
i am unable to understand why is it happening.
can some1 pls help.
thanks
 
L

Lene Fredborg

Sorry, the Shapes/InlineShapes problem was the only thing I could think of as
a possible cause in this situation.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


bhims said:
Hi Lene,
thanks for the reply, i checked out the lines. their wrapping styles are
"in-front of-text". so we can rule that option also.
i am unable to understand why this code is working fine with word 2000 then.
only things i changed for 2007 were importing Microsoft.Office.Interop and
Microsoft.Office.Core. rest i believe should work same. is there any specific
function or method i need to use along with d shapes function..

Lene Fredborg said:
Lines and other drawing object can be inserted in line with text, i.e. in the
text layer of the document – they are _InlineShapes_. Drawing objects with
any other wrapping style are _Shapes_. Have you checked the wrapping style of
your lines? Maybe the lines that are not found by your code are “in line with
textâ€.

To check the wrapping style of a line, right-click the line and select
“Format [object]â€. You will find the wrapping style on the Layout tab of the
dialog box that opens.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word


bhims said:
hi,
i am migrating an application from word 2000 to word 2007. during the
process i am facing trouble using shapes command.
the application is supposed to identify lines and store it in other
location.
the code i am using is:
doc.Application.Selection.WholeStory()
int_wordcount = doc.Application.Selection.Words.Count
doc.Application.Selection.HomeKey(Unit:=Word.WdUnits.wdStory)
For Each wline In doc.Shapes
If wline.Type = 9 Then ' Check for picture type as line
wline.Select()
..............
its working fine with word 2000, but in word 2007 its reading alternate
lines; as in it would detect 1st and 3rd line and leave 2nd and 4th.
i am unable to understand why is it happening.
can some1 pls help.
thanks
 

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