Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming,microsoft.public.office.developer.automation,microsoft.public.access
|
|||
|
|||
![]()
Actually, this turns out to be relatively simple; the key is knowing what
cells you want to draw the lines or boxes between, which is trivial really. 1. Each cell has .Left, .Top, .Width and .Height properties, so to determine the start and end points of the line/box you use something like: Set sht = xlApp.ActiveWorksheet lngLineLeft = sht.Cells(intRow, intStartCol).Left lngLineRight = sht.Cells(intRow, intEndCol).Left + sht.Cells(intRow, intEndCol).Width Same sort of thing for getting the top and bottom position of the line or box you want to draw 2. Then you use the one of the Shapes.AddXXXX methods to add the shape to that position on the spreadsheet. Below, I've listed the code I used to add a line, a box. Additionally, since I wanted a mouseover or control tip text type capability, I also added hyperlinks (that go nowhere) With sht.Shapes.AddLine(lngLineLeft, lngLineCenter, lngLineRight, lngLineCenter).Line .Weight = 3 .DashStyle = msoLineSolid .ForeColor.RGB = RGB(128, 128, 128) End With If IsNull(TipText) = False Then sht.Hyperlinks.Add sht.Shapes(sht.Shapes.Count), "", "", TipText End If Set shpBox = sht.Shapes.AddShape(msoShapeRound1Rectangle, lngBoxLeft, lngBoxTop, lngBoxRight - lngBoxLeft, 15) With shpBox .Fill.BackColor.RGB = RGB(121, 121, 113) .Fill.Transparency = 0.5 sht.Hyperlinks.Add shpBox, "", "", "Place your hyperlink text here" End With 3. Lastly, I wanted to be able to associate a label with each of the boxes, so I used the code below: Set shpLabel = sht.Shapes.AddTextbox(msoTextOrientationHorizontal , lngBoxLeft, lngBoxTop + 9, lngBoxRight - lngBoxLeft, 15) With shpLabel .TextEffect.Text = IIf(Milestone = "Event dates", "Main event", Milestone) .TextFrame.AutoSize = True .TextEffect.FontBold = msoTrue .TextEffect.FontSize = 10 End With Hope this helps the next guy that wants to try something like this. Dale |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using Excel with Visually Impaired and ZoomText | Setting up and Configuration of Excel | |||
Visually Impaired Using Excel with ZoomText | Excel Discussion (Misc queries) | |||
Calculating an Activities During Periods Of Natural Months and/or Dates | Excel Worksheet Functions | |||
setting excel visually | Excel Programming | |||
Can not visually see the shading on the EXCEL file? | Excel Discussion (Misc queries) |