G
Greg Maxey
Yesterday in the docManagement group there was some discussion on formatting
line drawing object drawn with Word2007. When these objects are drawn using
the UI, the style attribute is disabled.
Lines drawn in Word2003 and pasted into Word2007 can be fully formatted
(style enabled) in the UI. Also lines created in Word2007 using VBA can be
fully formatted in the UI.
I have put together some code intended to duplicate a line drawn using the
UI as a line that can be fully formatted and delete the original. I draw
the line and run this code:
Sub Test()
Dim oShp As Word.Shape
Dim oShpNew As Word.Shape
Dim i, j, k, l As Long
Set oShp = Selection.ShapeRange(1)
i = oShp.Left
j = oShp.Top
k = oShp.Height
l = oShp.Width
oShp.Delete
Set oShpNew = ActiveDocument.Shapes.AddLine(i, j, i + 72, j)
With oShpNew
.Left = i
.Top = j
.Width = l
.Height = k
With .Line
.Style = msoLineThinThin
.Weight = 3
End With
End With
End Sub
It works great provided the line is vertical, horizontal or slopes left to
right down the page. Lines that slope rigth to left down the page appear as
a mirror image of the original line sloped left to right down the page. I
could easily fix this using flip, but I can't figure out how to tell (with
the procedure) if the line will need flipping.
Does anyone have any ideas how to determine the direction of slope or any
other idea for correctly duplicationg rigth to left sloping lines?
Thanks.
--
Greg Maxey
See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.
"It is not the critic who counts, not the man who points out how the strong
man stumbles, or where the doer of deeds could have done them better. The
credit belongs to the man in the arena, whose face is marred by dust and
sweat and blood, who strives valiantly...who knows the great enthusiasms,
the great devotions, who spends himself in a worthy cause, who at the best
knows in the end the triumph of high achievement, and who at the worst, if
he fails, at least fails while daring greatly, so that his place shall never
be with those cold and timid souls who have never known neither victory nor
defeat." - TR
line drawing object drawn with Word2007. When these objects are drawn using
the UI, the style attribute is disabled.
Lines drawn in Word2003 and pasted into Word2007 can be fully formatted
(style enabled) in the UI. Also lines created in Word2007 using VBA can be
fully formatted in the UI.
I have put together some code intended to duplicate a line drawn using the
UI as a line that can be fully formatted and delete the original. I draw
the line and run this code:
Sub Test()
Dim oShp As Word.Shape
Dim oShpNew As Word.Shape
Dim i, j, k, l As Long
Set oShp = Selection.ShapeRange(1)
i = oShp.Left
j = oShp.Top
k = oShp.Height
l = oShp.Width
oShp.Delete
Set oShpNew = ActiveDocument.Shapes.AddLine(i, j, i + 72, j)
With oShpNew
.Left = i
.Top = j
.Width = l
.Height = k
With .Line
.Style = msoLineThinThin
.Weight = 3
End With
End With
End Sub
It works great provided the line is vertical, horizontal or slopes left to
right down the page. Lines that slope rigth to left down the page appear as
a mirror image of the original line sloped left to right down the page. I
could easily fix this using flip, but I can't figure out how to tell (with
the procedure) if the line will need flipping.
Does anyone have any ideas how to determine the direction of slope or any
other idea for correctly duplicationg rigth to left sloping lines?
Thanks.
--
Greg Maxey
See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.
"It is not the critic who counts, not the man who points out how the strong
man stumbles, or where the doer of deeds could have done them better. The
credit belongs to the man in the arena, whose face is marred by dust and
sweat and blood, who strives valiantly...who knows the great enthusiasms,
the great devotions, who spends himself in a worthy cause, who at the best
knows in the end the triumph of high achievement, and who at the worst, if
he fails, at least fails while daring greatly, so that his place shall never
be with those cold and timid souls who have never known neither victory nor
defeat." - TR