duration = Round((EndTime - StartTime) * 24 * 60)
Set GantShape = Worksheets(destSheet).Shapes.AddShape(msoShapeRectangle, LeftPoints, TopPoints, WidthPoints, HeightPoints)
With GantShape
.Fill.ForeColor.RGB = PatternType.Color
.Line.Weight = 0.25
.Name = "WorkingShape"
If inBoxString <> "" Then
Select Case equipment
Case "A"
If duration < 1.5 Then
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlLeft
Else
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlRight
End If
Case "B"
If duration < 0.5 Then
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlLeft
Else
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlRight
End If
Case "C"
If duration < 5 Then
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlLeft
Else
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlRight
End If
Case "D"
If duration < 60 Then
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlLeft
Else
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlRight
End If
Case "E"
If duration * 24 < 0.1 Then
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlLeft
Else
.TextFrame.Characters.Text = inBoxString
.TextFrame.Characters.Font.Size = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.FontStyle = PatternType.Parent.Font.Size
.TextFrame.Characters.Font.Color = PatternType.Parent.Font.Color
.TextFrame.VerticalAlignment = xlTop
.TextFrame.HorizontalAlignment = xlRight
End If
End Select
End If
End With
Bookmarks