Dirk,
Here is the code I pulled together. It assumes that you have your data in an
existing workbook and that the data (names) are in Named ranges[columns].
The short name [Tx or Cx]and diameter are to the right of the name columns,
hence the offsets.
Public Sub Draw_Circles()
' This routine draws circles (Tanks and Columns) based on data from Excel
Dim pageObj As Visio.Page
Dim shpObj As Visio.Shape, shp1obj As Visio.Shape
Dim localCentx As Double, ShapeHeight As Double
Dim localCenty As Double, ShapeWidth As Double, ShapeRadius As Double
Dim celObj1 As Visio.cell, celObj2 As Visio.cell
Dim dPageWidth, dPageHeight As Double
Dim appExcel As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim cell As Excel.Range
Dim FileName As String
Dim shpNam As String
Dim i As Double
On Error Resume Next
'Read the PageWidth and PageHeight properties.
dPageWidth = ActivePage.PageSheet.Cells("PageWidth").ResultIU
dPageHeight = ActivePage.PageSheet.Cells("PageHeight").ResultIU
'Set the file to be used
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
' Want this to be set up as a file dialog display but have not had
sucess yet
' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
FileName = "C:\My Documents\Local Files\Plant Layout Basis.xls"
' Start Excel
Set appExcel = CreateObject("excel.application")
appExcel.Visible = True
Set xlBook = appExcel.Workbooks.Open(FileName)
Set xlSheet = xlBook.Worksheets("sheet1")
i = 1 ' set space counter
For Each cell In Range("Tank_Short_Name") ' Do tanks
shpNam = cell.Value
ShapeRadius = cell.Offset(0, 1).Value
localCentx = (dPageWidth / 8 + i * 10) ' circle center x coordinate
for placement
localCenty = dPageHeight / 10 ' circle center y coordinate for
placement
' Create the circle
Set shpObj = ActivePage.DrawOval(localCentx, localCenty +
ShapeRadius, localCentx + ShapeRadius, localCenty)
shpObj.Cells("LineColor") = 0 ' Colour the line Black -
(Black;White;Red;Green;Blue;Yellow)
shpObj.Cells("Fillforegnd") = 1 ' Use a fill colour of White
'Set the text of the circle
shpObj.Text = shpNam
shpObj.SendToBack
i = i + 1
Next
i = 1 ' reset space counter
For Each cell In Range("Column_Short_Name") ' Do Columns
shpNam = cell.Value
ShapeRadius = cell.Offset(0, 1).Value
localCentx = (dPageWidth / 2 + i * 10) ' circle center x coordinate
for placement
localCenty = dPageHeight / 10 ' circle center y coordinate for
placement
' Create the circle
Set shpObj = ActivePage.DrawOval(localCentx, localCenty +
ShapeRadius, localCentx + ShapeRadius, localCenty)
shpObj.Cells("LineColor") = 0 ' Colour the line Red -
(Black;White;Red;Green;Blue;Yellow)
shpObj.Cells("Fillforegnd") = 1 ' Use a fill colour of Yellow
'Set the text of the circle
shpObj.Text = shpNam
shpObj.SendToBack
i = i + 1
Next
appExcel.Quit
Set appExcel = Nothing
End Sub