Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Change Color for Drawing Line Object

Below is code for a line drawing, but it defaults to Blue.
I would like to change the color to red.
------------------------------------------------
Sub mineLeft()

Dim nStart1 As Double, nStart2 As Double
Dim nEnd1 As Double, nEnd2 As Double
Dim rng1 As Range
Dim rng2 As Range

Set rng1 = ActiveCell.Offset(0, -1)
Set rng2 = ActiveCell.Offset(1, 0)
nStart1 = rng1.Left + rng1.Width
nStart2 = rng1.Top
nEnd1 = rng2.Left + rng2.Width
nEnd2 = rng2.Top

ActiveSheet.Shapes.AddLine(nStart1, nStart2, nEnd1, nEnd2).Select

End Sub
-----------------------------------------------------------

With Thanks
I tried the recorded macro to format the Line to Red.
The macro comes back empty.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Change Color for Drawing Line Object

Hi smandula,

ActiveSheet.Shapes.AddLine(nStart1, nStart2, nEnd1, nEnd2).Select


Change this line to
Set shp = ActiveSheet.Shapes.AddLine(nStart1, nStart2, nEnd1, nEnd2)
shp.Line.ForeColor.RGB = RGB(255, 0, 0)

Ed Ferrero
www.edferrero.com
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Change Color for Drawing Line Object


"The macro comes back empty."
Excel 2007 was released when it was "good enough"...

ActiveSheet.Shapes.AddLine(nStart1, nStart2, nEnd1, nEnd2).Line.ForeColor.SchemeColor = 10
--
Jim Cone
Portland, Oregon USA
(Shade Data Rows Excel add-in: http://tinyurl.com/ShadeData )








"smandula"
wrote in messageBelow is code for a line drawing, but it defaults to Blue.
I would like to change the color to red.
------------------------------------------------
Sub mineLeft()

Dim nStart1 As Double, nStart2 As Double
Dim nEnd1 As Double, nEnd2 As Double
Dim rng1 As Range
Dim rng2 As Range

Set rng1 = ActiveCell.Offset(0, -1)
Set rng2 = ActiveCell.Offset(1, 0)
nStart1 = rng1.Left + rng1.Width
nStart2 = rng1.Top
nEnd1 = rng2.Left + rng2.Width
nEnd2 = rng2.Top

ActiveSheet.Shapes.AddLine(nStart1, nStart2, nEnd1, nEnd2).Select

End Sub
-----------------------------------------------------------

With Thanks
I tried the recorded macro to format the Line to Red.
The macro comes back empty.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Change Color for Drawing Line Object

Thanks everyone for your help


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
Drawing toolbar: line color button hammonl Excel Discussion (Misc queries) 1 August 25th 09 03:25 PM
Can't change macro assigned to drawing object MarquisB Excel Programming 5 February 3rd 07 03:23 PM
How to change color of line and point markers on a line graph SASPerson Charts and Charting in Excel 1 November 15th 06 06:43 PM
Line Position Drawing Object Marvin Excel Programming 9 October 29th 06 12:12 AM
Make a line in a bar chart, and change color of any bars that exceed the line MarkM Excel Discussion (Misc queries) 4 July 5th 06 04:06 PM


All times are GMT +1. The time now is 06:00 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"