Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Fill Area Between Lines

In C++, you can draw a rectangle, then draw a bigger one around it,
then fill only the area between the two, leaving the inner rectangle
with no fill. This leaves the inner rectangle free to display
whatever's behind it. I cannot figure out a way to do this in VBA.
Whereas C++ has a fill function that will fill until it encounters a
different color border, I just don't see how to do this in VBA. Any
suggestions? TIA, James

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Fill Area Between Lines

Will you settle for two circles/ovals?
Insert a doughnut autoshape and adjust the color and size...

Sub MakeDoWithCircles()
With ActiveSheet.Shapes.AddShape(msoShapeDonut, 93, 103.5, 132, 129)
.Adjustments.Item(1) = 0.15 'adust inner circle.
.Fill.ForeColor.SchemeColor = 47 ' -7 = ColorIndex
End With
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Zone"

wrote in message
In C++, you can draw a rectangle, then draw a bigger one around it,
then fill only the area between the two, leaving the inner rectangle
with no fill. This leaves the inner rectangle free to display
whatever's behind it. I cannot figure out a way to do this in VBA.
Whereas C++ has a fill function that will fill until it encounters a
different color border, I just don't see how to do this in VBA. Any
suggestions? TIA, James

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Fill Area Between Lines

Jim,
Your doughnut shape is a new on me. Thanks for introducing me to
it. It's exactly the kind of effect I'm looking for. Unfortunately, I
do not see a way to control the angularity of the doughnut. Golly, if
I could use thing thing to fill the area between a larger and smaller
rectangle, it would be ideal. I don't see how I can get an angular
doughnut effect out it. I am working on a visual window (not a
Microsoft one), where the window panes are transparent to allow view of
the object beyond the panes, yet the area between the outer and inner
area of the window frame is filled in white. In C++, this is a simple
matter of creating two rectangles, one inside the other, and filling
the area in-between the borders of the two. Unfortunately, as I'm sure
you know, Excel requires that a 2-dimensional object be created (even
if it's created using a freeform) before it can fill the thing, and
then it fills the entire area of the thing. For my window, I'm having
to start with the window frame and then work outward, creating a left,
right, top and bottom window frame portion and a left, right, top and
bottom wall portion to keep from filling in the darn window panes. I
expect that this is the way I'm going to have to do it in Excel to
achieve an angular object inside of another angular object, with the
center left unfilled. Quite a 'pane' ! Anyway, thanks for the
doughnut. Any more ideas? James
Jim Cone wrote:
Will you settle for two circles/ovals?
Insert a doughnut autoshape and adjust the color and size...

Sub MakeDoWithCircles()
With ActiveSheet.Shapes.AddShape(msoShapeDonut, 93, 103.5, 132, 129)
.Adjustments.Item(1) = 0.15 'adust inner circle.
.Fill.ForeColor.SchemeColor = 47 ' -7 = ColorIndex
End With
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Zone"

wrote in message
In C++, you can draw a rectangle, then draw a bigger one around it,
then fill only the area between the two, leaving the inner rectangle
with no fill. This leaves the inner rectangle free to display
whatever's behind it. I cannot figure out a way to do this in VBA.
Whereas C++ has a fill function that will fill until it encounters a
different color border, I just don't see how to do this in VBA. Any
suggestions? TIA, James


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Fill Area Between Lines

Simply apply a border as thick as you want to a rectangle (or any other
autoshape). Borders support 2 colour patterns and a variety of line styles,
colour(s) can be any rgb not confined to the palette.

If you want to see whatever is behind the rectangle apply interior no-fill.

Regards,
Peter T


"Zone" wrote in message
oups.com...
In C++, you can draw a rectangle, then draw a bigger one around it,
then fill only the area between the two, leaving the inner rectangle
with no fill. This leaves the inner rectangle free to display
whatever's behind it. I cannot figure out a way to do this in VBA.
Whereas C++ has a fill function that will fill until it encounters a
different color border, I just don't see how to do this in VBA. Any
suggestions? TIA, James



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Fill Area Between Lines

Peter, Apparently I am not getting what you're saying. I want to
create an inner rectangle and an outer one and fill the area in-between
them without filling the smaller rectangle's interior. If I am missing
something, please expand on what you're saying. Regards, James
Peter T wrote:
Simply apply a border as thick as you want to a rectangle (or any other
autoshape). Borders support 2 colour patterns and a variety of line styles,
colour(s) can be any rgb not confined to the palette.

If you want to see whatever is behind the rectangle apply interior no-fill.

Regards,
Peter T


"Zone" wrote in message
oups.com...
In C++, you can draw a rectangle, then draw a bigger one around it,
then fill only the area between the two, leaving the inner rectangle
with no fill. This leaves the inner rectangle free to display
whatever's behind it. I cannot figure out a way to do this in VBA.
Whereas C++ has a fill function that will fill until it encounters a
different color border, I just don't see how to do this in VBA. Any
suggestions? TIA, James




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Fill Area Between Lines

James,
"Any more ideas?"

I like Peter T's suggestion of adjusting the border width...

Sub JustOneWillDoIt()
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 99, 132, 99, 99)
.Line.Weight = 40
.Fill.Visible = msoFalse
End With
End Sub
'-----------

However if the size of the filled portions are not a constant then perhaps
instead of inserting one rectangle, insert 4 rectangles to make up
the fill area. The rectangle's borders do not have to show, so the 4 graphics
could even overlap. Something like this? ...
'-------------------
Sub UseMultipleRetangles()
Dim shpOne As Excel.Shape
Dim shpTwo As Excel.Shape

' vertical left ' left, top, width, height
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 69.75, 132, 50.25, 258)
'vertical right
Set shpOne = .Duplicate
shpOne.Left = .Left + .Width + 279
shpOne.Top = .Top
End With
' horizontal top
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 120, shpOne.Top, 279, 45)
'horizontal bottom
Set shpTwo = .Duplicate
shpTwo.Left = .Left
shpTwo.Top = shpOne.Top + shpOne.Height - .Height
' .Line.Visible = msoFalse
End With
End Sub
-----------
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Fill Area Between Lines

I had something like this in mind -

Sub test()
Dim shp As Shape
Set shp = ActiveSheet.Shapes.AddShape(1&, 60#, 60#, 210#, 90#)
With shp.Line
.Weight = 36
'.Style = msoLineThickThin
.ForeColor.RGB = RGB(33, 145, 255) ' or use a schemecolor
.Visible = True
End With
shp.Fill.Visible = msoFalse
shp.Visible = msoTrue
shp.Select
End Sub

Regards,
Peter T

"Zone" wrote in message
s.com...
Peter, Apparently I am not getting what you're saying. I want to
create an inner rectangle and an outer one and fill the area in-between
them without filling the smaller rectangle's interior. If I am missing
something, please expand on what you're saying. Regards, James
Peter T wrote:
Simply apply a border as thick as you want to a rectangle (or any other
autoshape). Borders support 2 colour patterns and a variety of line

styles,
colour(s) can be any rgb not confined to the palette.

If you want to see whatever is behind the rectangle apply interior

no-fill.

Regards,
Peter T


"Zone" wrote in message
oups.com...
In C++, you can draw a rectangle, then draw a bigger one around it,
then fill only the area between the two, leaving the inner rectangle
with no fill. This leaves the inner rectangle free to display
whatever's behind it. I cannot figure out a way to do this in VBA.
Whereas C++ has a fill function that will fill until it encounters a
different color border, I just don't see how to do this in VBA. Any
suggestions? TIA, James




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Fill Area Between Lines

Thanks, Jim and Peter. Your ideas look promising. I especially like
Peter's rectangle with the fat borders. I didn't know the border could
be so thick. Jim, your 4-rectangle solution is pretty much what I'm
doing. It's workable, but ends up with 8 rectangles by the time I
create the wall around it. Anyway, I'll study these ideas and see if I
can adapt one or more of them. Again, many thanks! James

Jim Cone wrote:
James,
"Any more ideas?"

I like Peter T's suggestion of adjusting the border width...

Sub JustOneWillDoIt()
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 99, 132, 99, 99)
.Line.Weight = 40
.Fill.Visible = msoFalse
End With
End Sub
'-----------

However if the size of the filled portions are not a constant then perhaps
instead of inserting one rectangle, insert 4 rectangles to make up
the fill area. The rectangle's borders do not have to show, so the 4 graphics
could even overlap. Something like this? ...
'-------------------
Sub UseMultipleRetangles()
Dim shpOne As Excel.Shape
Dim shpTwo As Excel.Shape

' vertical left ' left, top, width, height
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 69.75, 132, 50.25, 258)
'vertical right
Set shpOne = .Duplicate
shpOne.Left = .Left + .Width + 279
shpOne.Top = .Top
End With
' horizontal top
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, 120, shpOne.Top, 279, 45)
'horizontal bottom
Set shpTwo = .Duplicate
shpTwo.Left = .Left
shpTwo.Top = shpOne.Top + shpOne.Height - .Height
' .Line.Visible = msoFalse
End With
End Sub
-----------
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html


Reply
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
How to fill the area between two lines in excel graph? dypw2007 Charts and Charting in Excel 2 April 3rd 23 07:28 PM
Radar chart with Area and Lines CrownEquip-Jen Charts and Charting in Excel 1 November 13th 09 03:14 PM
How to fill the area between lines in graph DExcel Charts and Charting in Excel 2 July 22nd 09 08:05 PM
Area between two lines in a chart Tulane chic New Users to Excel 1 June 13th 06 03:45 PM
Grid Lines on an Area Chart Phil Hageman Charts and Charting in Excel 1 September 21st 05 11:53 PM


All times are GMT +1. The time now is 11:15 PM.

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"