Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color on a horizontal line 2

Status
Not open for further replies.

BrianWen

Programmer
Jun 8, 2009
102
DK
I have a small problem, I can't figure out.
I add a horizontal line with something like this:

With Selection.InlineShapes.AddHorizontalLineStandard
.Width = CentimetersToPoints(6)
.Height = 0.8
.Fill.Solid
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Fill.BackColor.RGB = RGB(0, 0, 0)
End With


Problem is that .Solid doesn't seem to work, and I can't figure out how to access the properties box while recording a macro to see how to do it. When right clicking a line and choosing Format horizontal line there's an option called Use solid color (no shade), which makes the line solid black...I can't figure out how to activate that with VBA.
The .Fill.Solid doesn't make any errors, but the line doesn't go all black (and it doesn't get ticked) as if I chose the option manually...

Any help is very much appreciated!!
 
Try this:
Code:
With Selection.InlineShapes.AddHorizontalLineStandard
    .Width = CentimetersToPoints(6)
    .Height = 0.8
    .Fill.Solid
    .HorizontalLineFormat.NoShade = True
    .Fill.ForeColor.RGB = RGB(0, 0, 0)
    .Fill.BackColor.RGB = RGB(0, 0, 0)
  End With
Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

http
 
In addition, if you want to access the properties of the line while recording a macro, try this. Select the line before you start recording, then once recording press the context menu button on your keyboard (next to the right Ctrl key) and navigate through that using the keyboard to Format Horizontal Line. Once you've done that you can set the properties as normal.

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

http
 
PERFECT!!

Thanks for the quick reply...I must have overlooked that one :/
 
No problem, glad I could help [smile]

Thanks for the star.

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
And if you do not have a context menu button on your keyboard....Shift-F10. This is the standard keyboard equivalent to a right-button click on all Windows compliant applications.

This can be handy when recording macros, as in some places the mouse will not record, but Shift-F10 will.

Gerry
 
Good point. I didn't know how to circumvent the lacking ability of right clicking while recording!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top