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: 23
Default Shapes & Drawing Object Bug Excel 2007 Beta 2

The old Excel 95 Drawing Object was replaced by Shapes in Excel 97, but
the Drawing Object interface was retained. Very handy for keeping
compatibility. But there appears to be a critical bug introduced for
interiors. The code bellow dies at

With Selection.Interior
.Pattern = xlSolid

What is the best way to submit a bug report?

(The move in Excel 97 to shapes brought a *huge* performance penalty if
there was a large number of shapes due to a linear search each time one
was referenced (ie. the VBA pointer is dereferenced). That remains
which ever interface (Shapes or Drawing Object) that one uses to access
them. It also remains through the versions, at least until Excel 2003.
Putting in a proper hash table would also be wonderful.)

Anthony

----------------------------



Option Explicit
Sub TestAll()
Debug.Print "--------------------------"
Sheets.Add
DrawShapes
ShapesPrint "Oval 97"
DrawObj95
DObjPrint "Oval 95"
ShapesPrint "Oval 95"
DObjPrint "Oval 97"
End Sub

Sub ShapesPrint(name$)
Dim s As Shape
Set s = ActiveSheet.Shapes(name)
Debug.Print "Shape Name", s.name, TypeName(s),
s.Fill.ForeColor.SchemeColor
End Sub
Sub DObjPrint(name$)

Dim dobj As Object ' DrawingObject "not defined"
Set dobj = ActiveSheet.DrawingObjects(name)
Debug.Print "DObj", dobj.name, TypeName(dobj) ' -- Oval
End Sub


Sub DrawShapes()
Dim oval As Object

ActiveSheet.Shapes.AddShape(msoShapeRectangle, 219.75, 24.75, 96#,
60.75). _
Select
Set oval = ActiveSheet.Shapes.AddShape(msoShapeOval, 219#, 123#,
103.5, 50.25)
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, 220.5,
229.5, _
103.5, 69#).Select
Selection.Characters.Text = "XL97 style"

oval.Select
Selection.name = "Oval 97"
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 14
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 64
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)

End Sub

Sub DrawObj95()
Dim oval As Object
ActiveSheet.Rectangles.Add(36, 28.5, 73.5, 41.25).Select
Selection.Interior.ColorIndex = xlNone
Set oval = ActiveSheet.Ovals.Add(36.75, 96.75, 69.75, 37.5)
ActiveSheet.TextBoxes.Add(39, 169.5, 75, 52.5).Select
Selection.Interior.ColorIndex = 2
Selection.Characters.Text = "Hello XL95"

oval.Select
Selection.name = "Oval 95"
With Selection.Interior
.Pattern = xlSolid
.ColorIndex = 3
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
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
Drawing shapes in a chart ChadTarget Charts and Charting in Excel 1 September 21st 06 09:07 AM
Excel 2007 Beta 2 - Macro Run-time error '424' Object required jcm21 Excel Programming 0 June 16th 06 07:17 PM
Trouble Drawing shapes with macros in Excel SDuguay Excel Programming 2 September 20th 04 02:20 PM
regarding: Trouble Drawing shapes with macros in Excel SDuguay Excel Programming 0 September 17th 04 06:20 PM


All times are GMT +1. The time now is 07:25 AM.

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

About Us

"It's about Microsoft Excel"