Hello to all and excused for my bad English
With following macro I can easily draw a line
sub draw_line ()
Xp1 = 1
Yp1 = 60
Xp2 = 1900
Yp2 = 60
ActiveSheet.Shapes.AddLine (Xp1, Yp1, Xp2, Yp2). Name = "line1"
end sub
We suppose that with a successive macro I want to determine the used
parameters in order to trace the line1.
What's the method to determine the 4 used parameters in order to trace the
line through code VBA; that is Xp1 Yp1 Xp2 Yp2?
Thanks for the attention.
Diego.
'-------------------------------------------
Sub draw_line()
Dim Xp1 As Single, Yp1 As Single
Dim Xp2 As Single, Yp2 As Single
Xp1 = 1
Yp1 = 60
Xp2 = 1900
Yp2 = 60
ActiveSheet.Shapes.AddLine(Xp1, Yp1, Xp2, Yp2).Name = "line1"
End Sub
Sub get_line_coord()
Dim Xp1 As Single, Yp1 As Single
Dim Xp2 As Single, Yp2 As Single
Dim shLine As Shape
Set shLine = ActiveSheet.Shapes("line1")
Xp1 = shLine.Left
Yp1 = shLine.Top
Xp2 = Xp1 + shLine.Width
Yp2 = Yp1 + shLine.Height
MsgBox "P1: " & Xp1 & ", " & Yp1 & vbCrLf & _
"P2: " & Xp2 & ", " & Yp2
End Sub
'-------------------------------------------------
HTH
--
AP
"skimer" <skimerLEVAQUESTO@cab11.com> a écrit dans le message de news:
447d46dd$0$36931$4fafbaef@reader3.news.tin.it...
> Hello to all and excused for my bad English
>
> With following macro I can easily draw a line
>
> sub draw_line ()
> Xp1 = 1
> Yp1 = 60
> Xp2 = 1900
> Yp2 = 60
> ActiveSheet.Shapes.AddLine (Xp1, Yp1, Xp2, Yp2). Name = "line1"
> end sub
>
> We suppose that with a successive macro I want to determine the used
> parameters in order to trace the line1.
> What's the method to determine the 4 used parameters in order to trace the
> line through code VBA; that is Xp1 Yp1 Xp2 Yp2?
>
> Thanks for the attention.
> Diego.
>
>
Look at the left, top, height and width properties of the Shape object.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"skimer" <skimerLEVAQUESTO@cab11.com> wrote in message
news:447d46dd$0$36931$4fafbaef@reader3.news.tin.it...
> Hello to all and excused for my bad English
>
> With following macro I can easily draw a line
>
> sub draw_line ()
> Xp1 = 1
> Yp1 = 60
> Xp2 = 1900
> Yp2 = 60
> ActiveSheet.Shapes.AddLine (Xp1, Yp1, Xp2, Yp2). Name = "line1"
> end sub
>
> We suppose that with a successive macro I want to determine the used
> parameters in order to trace the line1.
> What's the method to determine the 4 used parameters in order to trace the
> line through code VBA; that is Xp1 Yp1 Xp2 Yp2?
>
> Thanks for the attention.
> Diego.
>
>
Perfect !!!
Thanks of all ;-)))
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks