Code to select only lines in a drawing

X

XP

Using Office 2003 and Windows XP;

Is there a way using code (or otherwise) to quickly select only the line
drawing objects on the current page. i.e. only lines, not boxes or other
shapes?

If possible could someone please post generic example code to do this?

Thanks in advance.
 
J

Jean-Guy Marcil

XP said:
Using Office 2003 and Windows XP;

Is there a way using code (or otherwise) to quickly select only the line
drawing objects on the current page. i.e. only lines, not boxes or other
shapes?

If possible could someone please post generic example code to do this?

Just cycle the shape collection and select those that have a height equal to
zero.
 
X

XP

FYI, I was wanting to figure out how to send all lines to back and I thought
I needed an array, but then your post made me realize I could just set them
in the loop; also, I have vertical lines as well, so basing on what you
suggested I worked this out:

Private Function SendAllLinesBack()
'sends all drawing lines to back in zorder of objects:
Dim oSHP As Shape
For Each oSHP In ThisDocument.Shapes
If (oSHP.Height = 0 Or oSHP.Width = 0) Then
oSHP.ZOrder msoSendToBack
End If
Next oSHP
End Function

Thanks!
 
J

Jean-Guy Marcil

XP said:
FYI, I was wanting to figure out how to send all lines to back and I thought
I needed an array, but then your post made me realize I could just set them
in the loop; also, I have vertical lines as well, so basing on what you
suggested I worked this out:

Private Function SendAllLinesBack()
'sends all drawing lines to back in zorder of objects:
Dim oSHP As Shape
For Each oSHP In ThisDocument.Shapes
If (oSHP.Height = 0 Or oSHP.Width = 0) Then
oSHP.ZOrder msoSendToBack
End If
Next oSHP
End Function

Glad that you worked it out!
 

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