Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 25 2007, 3:42 pm, TONY wrote:
Below is a macro that first creates "cross hairs" on the spread sheet No problem her. In addition a 3rd line is created with an arrow head no problem here either. I can select the arrow open the format boxx and change it's rotation with no problem, however I can not from within the program itself. The arrow moves to aprox 45 degrees and does not at all. Sub Macro20() ' ' Macro20 Macro ' Macro recorded 12/24/2007 by Anthony Keefe ' cSize = 50 Range("a1").Select Set myHz = ActiveSheet.Shapes.AddLine(0.075, Application.UsableHeight * 0.5, Application.UsableWidth, Application.UsableHeight * 0.5) Set myv = ActiveSheet.Shapes.AddLine(Application.UsableWidth * 0.5, 0.075, Application.UsableWidth * 0.5, Application.UsableHeight) Set dial = ActiveSheet.Shapes.AddLine(Application.UsableWidth * 0.5 - cSize, Application.UsableHeight * 0.5 + cSize, _ (Application.UsableWidth * 0.5 + cSize), (Application.UsableHeight * 0.5) - cSize) With dial.Line .EndArrowheadStyle = msoArrowheadTriangle .EndArrowheadLength = msoArrowheadLengthMedium .EndArrowheadWidth = msoArrowheadWidthMedium End With With dial .Rotation = 0# ' Reset arrow to 0 .Rotation = 1# .Rotation = 2# End With myHz.delete myv.delete dial.delete End Sub Hi Tony, I'm not sure what it is that you're trying to do, but I'm guessing you want to see that arrow rotate. You're original code will make the arrow rotate, the only important thing missing is DoEvents. To illustrate, below is your original code with a Do Loop thrown in with an incrementing Single (K). You can alter the rotation speed by increasing the increment size eg K = K + 2 is faster and K = K + 0.5 is slower. All I have done is added "Dim K as Single" at the top and replaced... ..Rotation = 0# ' Reset arrow to 0 .Rotation = 1# .Rotation = 2# with... Do While K < 720 'Two revolutions K = K + 1 .Rotation = K DoEvents Loop Sub Macro20() ' ' Macro20 Macro ' Macro recorded 12/24/2007 by Anthony Keefe ' Dim K As Single cSize = 50 Range("a1").Select Set myHz = ActiveSheet.Shapes.AddLine(0.075, Application.UsableHeight * 0.5, _ Application.UsableWidth, Application.UsableHeight * 0.5) Set myv = ActiveSheet.Shapes.AddLine(Application.UsableWidth * 0.5, 0.075, _ Application.UsableWidth * 0.5, Application.UsableHeight) Set dial = ActiveSheet.Shapes.AddLine(Application.UsableWidth * 0.5 - _ cSize, Application.UsableHeight * 0.5 + cSize, _ (Application.UsableWidth * 0.5 + _ cSize), (Application.UsableHeight * 0.5) - cSize) With dial.Line .EndArrowheadStyle = msoArrowheadTriangle .EndArrowheadLength = msoArrowheadLengthMedium .EndArrowheadWidth = msoArrowheadWidthMedium End With With dial Do While K < 720 'Two revolutions K = K + 1 .Rotation = K DoEvents 'this enable visible rotation of the arrow 'Doesn't work as well on a Mac (OSX), where you have to 'continually move the mouse to achieve visible motion, which sucks. Loop End With myHz.Delete myv.Delete dial.Delete End Sub Ken Johnson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting Drawing Object By Name | Excel Programming | |||
Floating Drawing Object | Excel Programming | |||
Drawing Object in a Userform | Excel Programming | |||
Drawing Object | Excel Programming | |||
Drawing object references | Excel Programming |