This is some stuff that I use. I keep some globals in the document code so
the different modules can get to them.
al
Public Sub InsertCylindricalInterval _
(Optional ByVal blnDate As Boolean = False, _
Optional ByVal blnText As Boolean = False, _
Optional ByVal intColor As Integer = visYellow)
' this is a group with three components
' there are two text boxes, one with a single text line and one with two
' the two text line object are the dates
' the single text line is the description
' prop.visType
' prop.visPercent
' prop.visName
' prop.visIntervalBegin
' prop.visIntervalEnd
' user.visShapeType = 11
Dim visApp As Visio.Application
Set visApp = Application
Dim visDoc As Visio.Document
Dim visMaster As Visio.Master
Dim visTL As Visio.Shape
Dim dblBeginDate As Double
dblBeginDate = CDbl(ThisDocument.tlStartDate)
If dblBeginDate = 0 Then Exit Sub
Dim dblBeginTime As Double
dblBeginTime = CDbl(ThisDocument.tlStartTime)
Dim dblEndDate As Double
dblEndDate = CDbl(ThisDocument.tlEndDate)
If dblEndDate = 0 Then Exit Sub
If dblEndDate < dblBeginDate Then Exit Sub
Dim dblEndTime As Double
dblEndTime = CDbl(ThisDocument.tlEndTime)
Set visDoc = Application.Documents.Item("TIMELN_U.VSS")
Set visMaster = visDoc.Masters.ItemU("Cylindrical interval")
visApp.AlertResponse = 1
Set visTL = visApp.ActiveWindow.Page.Drop _
(visMaster, _
ThisDocument.tlPinX, _
ThisDocument.tlPinY)
'
' put the dates into the timeline
'
Dim visCell As Visio.Cell
If visTL.CellExists("user.visintervalbegin", False) = True Then
Set visCell = visTL.Cells("user.visintervalbegin")
visCell.FormulaU = dblBeginDate + dblBeginTime
End If
If visTL.CellExists("user.visintervalend", False) = True Then
Set visCell = visTL.Cells("user.visintervalend")
visCell.FormulaU = dblEndDate + dblEndTime
End If
If visTL.CellExists("prop.visname", False) = True Then
Set visCell = visTL.Cells("prop.visname")
visCell.Formula =
StringToFormulaForString(ThisDocument.tlDescription)
End If
' this is the transparency value
' turn off the date leave the description
ToggleIntervalVisibility visTL, blnDate, blnText
setIntervalColor visTL, intColor
visApp.AlertResponse = 0
End Sub