LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel VBA drawing Arcs programmatically - not lining up!

Hi,

I'm trying to create a dial-type control for an Excel-based report. The
shape I'm after is basically the top half of a pie chart, and I'll add
numbers, needles etc.

I'm using msoShapeArc to create specific zones for the dial e.g.
green-amber-red, which will be a 0-100% scale. It's almost working, but using
the .Adjustment(1) and (2) settings to set the angles is shifting the arcs
out of line, and I can't figure out why! The code is below - any help greatly
appreciated.

To see the problem exaggerated, repeat the line ".Adjustments(1) = 144" in
the second segment and watch the arc shift right each time. For some reason
it's not all of the arcs, just the some (the 2nd in this axample).

Thanks,

Pat.

Sub DrawDial()

Dim myArc As Shape

For Each myArc In ActiveSheet.Shapes
myArc.Delete
Next myArc

'draw first segment
Set myArc = ActiveSheet.Shapes.AddShape(msoShapeArc, 200, 100, 100, 100)
With myArc
.Adjustments(1) = 180
.Adjustments(2) = 144
.Fill.Visible = msoTrue
.Fill.Transparency = 0.3
.Fill.ForeColor.SchemeColor = 11
End With

'draw second segment
Set myArc = ActiveSheet.Shapes.AddShape(msoShapeArc, 200, 100, 100, 100)
With myArc
'THIS NEXT LNE SHIFTS THE ARC RIGHT BY 1 POINT!
.Adjustments(1) = 144
.Adjustments(2) = 70
.Fill.Visible = msoTrue
.Fill.Transparency = 0.3
.Fill.ForeColor.SchemeColor = 53
End With

'draw third segment
Set myArc = ActiveSheet.Shapes.AddShape(msoShapeArc, 200, 100, 100, 100)
With myArc
.Adjustments(1) = 70
.Adjustments(2) = 0
.Fill.Visible = msoTrue
.Fill.Transparency = 0.3
.Fill.ForeColor.SchemeColor = 10
End With

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lining up 3 excel sheets/ 4 columns/all different GAnad Excel Worksheet Functions 0 December 17th 10 05:44 PM
Lining up values [email protected] Excel Worksheet Functions 1 March 5th 08 02:44 AM
Lining Tables pinehead Excel Worksheet Functions 1 February 27th 06 03:15 AM
Drawing Arcs PraxisPete Excel Programming 3 May 25th 05 03:49 PM
Drawing a Curve programmatically Nichevo Excel Programming 1 December 5th 03 04:20 PM


All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"