Make the bottom border of textbox visible

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have below macro that create boxes and I need to show only the bottom borders of these boxes, can anyone help me with that?

Code:
'''BUILD THE eCnt LABEL BOX'''    
    ew = galaxyF.Width / 2.3
    eh = galaxyF.Height / eCnt
    el = galaxyF.Left
    et = galaxyF.Top + (eh * (e - 1))
Set Empl_Lbl = rSht.Shapes.AddShape(msoShapeRectangle, el, et, ew, eh)
With Empl_Lbl
    .Name = "Empl_" & e & "_Lbl"
    .Placement = xlFreeFloating
    .Fill.ForeColor.RGB = RGB(255, 255, 255)
    .Fill.Visible = msoFalse
    .Line.ForeColor.RGB = RGB(100, 100, 100)
    .Line.Visible = False
    .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
    .TextFrame2.TextRange.Font.Size = 8
    .TextFrame2.TextRange.Font.Name = "Tahoma"
    .TextFrame.MarginLeft = 0.05 * pix
    .TextFrame.MarginRight = 0.05 * pix
    .TextFrame.MarginTop = 0.05 * pix
    .TextFrame.MarginBottom = 0.05 * pix
    .TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignLeft
    .TextFrame2.VerticalAnchor = msoAnchorMiddle
    .TextFrame2.AutoSize = msoAutoSizeNone
    .TextFrame.VerticalOverflow = xlOartVerticalOverflowOverflow
    .TextFrame.HorizontalOverflow = xlOartHorizontalOverflowOverflow
    .TextFrame2.WordWrap = msoTrue




.TextFrame2.TextRange.Characters.Text = "LABEL " & e & ":"
    .TextFrame2.TextRange.Font.Bold = msoTrue
End With
 
Check my suggestion in post # 7.
upload the image to dropbox and paste the link here
 
Upvote 0

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Immediately after creating the shape you must create the line. Example:

Code:
    el = galaxyF.Left
    et = galaxyF.Top + (eh * (e - 1))
    ew = galaxyF.Width / 2.3
    eh = galaxyF.Height / eCnt


    Set Empl_Lbl = rsht.Shapes.AddShape(msoShapeRectangle, el, et, ew, eh)
    
[B][COLOR=#0000ff]    Set empl_lin = rsht.Shapes.AddLine(el, et + eh, el + ew, et + eh).Line[/COLOR][/B]
    
    With Empl_Lbl
        .Name = "Empl_" & e & "_Lbl"
        .Placement = xlFreeFloating
        .Fill.ForeColor.RGB = RGB(255, 255, 255)
        .Fill.Visible = msoFalse
        .Line.ForeColor.RGB = RGB(100, 100, 100)
        .Line.Visible = False
        .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
        .TextFrame2.TextRange.Font.Size = 8
        .TextFrame2.TextRange.Font.Name = "Tahoma"
        .TextFrame.MarginLeft = 0.05 * pix
        .TextFrame.MarginRight = 0.05 * pix
        .TextFrame.MarginTop = 0.05 * pix
        .TextFrame.MarginBottom = 0.05 * pix
        .TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignLeft
        .TextFrame2.VerticalAnchor = msoAnchorMiddle
        .TextFrame2.AutoSize = msoAutoSizeNone
        .TextFrame.VerticalOverflow = xlOartVerticalOverflowOverflow
        .TextFrame.HorizontalOverflow = xlOartHorizontalOverflowOverflow
        .TextFrame2.WordWrap = msoTrue
        .TextFrame2.TextRange.Characters.Text = "LABEL " & e & ":"
        .TextFrame2.TextRange.Font.Bold = msoTrue
    End With
 
Last edited:
Upvote 0
OMG! that's exactly what I want, thank you so much.
But when I ran the macro the lines took exactly the size of the Emp_Lbl what I need is the line size to take the size of galaxyF.Width, then name the new lines as

Code:
.Name = "Empl_" & e & "_line"

How can I do that?
 
Upvote 0
I made it :) with this macro :)

Code:
    ew = galaxyF.Width - Empl_Lbl.Width    eh = Empl_Lbl.Height
    el = Empl_Lbl.Left + Empl_Lbl.Width
    et = Empl_Lbl.Top
    Ll = galaxyF.Left
   


Set Empl_Txt = rSht.Shapes.AddShape(msoShapeRectangle, el, et, ew, eh)
Set Empl_Lin = rSht.Shapes.AddLine(Ll, et + eh, el + ew, et + eh).Line


With Empl_Txt
    .Name = "Empl_" & e & "_Txt"
    .Placement = xlFreeFloating
    .Fill.ForeColor.RGB = RGB(255, 255, 255)
    .Fill.Visible = msoFalse
    .Line.ForeColor.RGB = RGB(100, 100, 100)
    .Line.Visible = False
    
    .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
    .TextFrame2.TextRange.Font.Size = 8
    .TextFrame2.TextRange.Font.Name = "Tahoma"
    .TextFrame.MarginLeft = 0.05 * pix
    .TextFrame.MarginRight = 0.05 * pix
    .TextFrame.MarginTop = 0.05 * pix
    .TextFrame.MarginBottom = 0.05 * pix
    .TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignLeft
    .TextFrame2.VerticalAnchor = msoAnchorMiddle
    .TextFrame2.AutoSize = msoAutoSizeNone
    .TextFrame.VerticalOverflow = xlOartVerticalOverflowOverflow
    .TextFrame.HorizontalOverflow = xlOartHorizontalOverflowOverflow
    .TextFrame2.WordWrap = msoTrue


.TextFrame2.TextRange.Characters.Text = "TEXT " & Format(e, "00000")
    .TextFrame2.TextRange.Font.Bold = msoFalse




End With

I only need now to name these lines
Code:
[COLOR=#333333].Name = "Empl_" & e & "_line"[/COLOR]
 
Upvote 0
And here's the final successful macro, thank you soooo much for your help!

Code:
'''BUILD THE eCnt TEXT BOX'''    ew = galaxyF.Width - Empl_Lbl.Width
    eh = Empl_Lbl.Height
    el = Empl_Lbl.Left + Empl_Lbl.Width
    et = Empl_Lbl.Top
    Ll = galaxyF.Left
   


Set Empl_Txt = rSht.Shapes.AddShape(msoShapeRectangle, el, et, ew, eh)




With Empl_Txt
    .Name = "Empl_" & e & "_Txt"
    .Placement = xlFreeFloating
    .Fill.ForeColor.RGB = RGB(255, 255, 255)
    .Fill.Visible = msoFalse
    .Line.ForeColor.RGB = RGB(100, 100, 100)
    .Line.Visible = False
    
    .TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
    .TextFrame2.TextRange.Font.Size = 8
    .TextFrame2.TextRange.Font.Name = "Tahoma"
    .TextFrame.MarginLeft = 0.05 * pix
    .TextFrame.MarginRight = 0.05 * pix
    .TextFrame.MarginTop = 0.05 * pix
    .TextFrame.MarginBottom = 0.05 * pix
    .TextFrame2.TextRange.ParagraphFormat.Alignment = msoAlignLeft
    .TextFrame2.VerticalAnchor = msoAnchorMiddle
    .TextFrame2.AutoSize = msoAutoSizeNone
    .TextFrame.VerticalOverflow = xlOartVerticalOverflowOverflow
    .TextFrame.HorizontalOverflow = xlOartHorizontalOverflowOverflow
    .TextFrame2.WordWrap = msoTrue


    .TextFrame2.TextRange.Characters.Text = "TEXT " & Format(e, "00000")
    .TextFrame2.TextRange.Font.Bold = msoFalse


End With


Set Empl_Lin = rSht.Shapes.AddLine(Ll, et + eh, el + ew, et + eh)


With Empl_Lin
    .Name = "Empl_" & e & "_line"
    .Placement = xlFreeFloating
    .Fill.Visible = msoFalse
    .Line.ForeColor.RGB = RGB(100, 100, 100)
    .Line.DashStyle = msoLineSysDash
    .Line.Visible = True
    
End With


Next e
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top