Hi again,
This is building on my last question but new so new post. I have recreated all the shapes that I need in the form that I mentioned in my last post and I have the shapes dropping on the sheet correctly. The problem that I am having now is that I can't change any of the prop.X values to what I need. Here is how I am dropping the shapes
Dim counter As Integer
dblX = 1
dblY = 1
For counter = 1 To ThisDocument.DataRecordsets.Count
If ThisDocument.DataRecordsets(counter).Name = "Visio Shapes" Then
lngDataRecordsetID = ThisDocument.DataRecordsets(counter).ID
rstIndex = counter
End If
Next
Set vsoDataRecordset = ThisDocument.DataRecordsets(rstIndex)
lngRowIDs = vsoDataRecordset.GetDataRowIDs("")
For lngRow = LBound(lngRowIDs) + 1 To UBound(lngRowIDs) + 1
varRowData = vsoDataRecordset.GetRowData(lngRow)
Set vsoMaster = Visio.Documents(varRowData(14) + ".vss").Masters(varRowData(8))
dblX = dblX + 0.5
dblY = dblY + 0.5
Set vsoShape = ActivePage.Drop(vsoMaster, dblX, dblY)
error line -> vsoShape.Cells("Prop.title").Formula = Chr(34) & varRowData(0) & Chr(34)
'vsoShape.Cells("Prop.Entitlements").Formula = Chr(34) & varRowData(1) & Chr(34)
'vsoShape.Cells("Prop.environ").Formula = Chr(34) & varRowData(2) & Chr(34)
'vsoShape.Cells("Prop.netZone").Formula = Chr(34) & varRowData(3) & Chr(34)
'vsoShape.Cells("Prop.Mem").Formula = Chr(34) & varRowData(4) & Chr(34)
'vsoShape.Cells("Prop.vcpu_cores").Formula = Chr(34) & varRowData(5) & Chr(34)
'vsoShape.Cells("Prop.sockets").Formula = Chr(34) & varRowData(6) & Chr(34)
'vsoShape.Cells("Prop.hosts").Formula = Chr(34) & varRowData(7) & Chr(34)
'vsoShape.Cells("Prop.shape").Formula = Chr(34) & varRowData(8) & Chr(34)
'vsoShape.Cells("Prop.shapeKey").Formula = Chr(34) & varRowData(15) & Chr(34)
Next lngRow
The error I am getting is
QuoteRun-time error '-2032466967 (86db03e9)': Unexpected end of file
regarding the error, this is what MS has to say
QuoteCellsU("somestring") raises an "Unexpected end of file" exception if "somestring" does not name an actual cell.
I know the property name is correct. I think the problem is that once I drop the shape, I am not referencing it correctly since it can't seem to find the property. I think that I have to go down one more layer to find them. I can change the approach if needed. I and thinking that I can drop the shape then update the values. There doesn't seem to be a lot of useful Visio data out there... for what I am doing, at least.
in the master explorer, here is the hierarchy
masters
shape name
layers
shapes
shapename (again)
source-data
<this is where the property shapes are>
Michael
I did some testing. I create a shape from the start but only used one group instead of the two as noted above and it worked as expected. it is something to do with the "source-data" and "shapename (again)". Visio is not searching the "source-data" where the properties are associated. There might be something else that I need to need to do to find them but as of now, it might be faster to created the shapes... again... sigh. While it is annoying, it is a good learning experience. hopefully, there will be a suggestion to avoid that :).
your's is a very common beginners programming error in that the issue is where do you start to count and when to stop counting. Recordset id's start at '0' not '1'.
For counter = 0 To ThisDocument.DataRecordsets.Count - 1
might be a little better.
You should probably take a look at the Visio SDK for examples of reading rows from a recordset because that also has some subtleties on row numbering.
al
In this case, it isn't reading form the recordset, it is accessing the prop.X values and setting them to what I need. The recordset processing works fine.
Solution (rather than an answer as this is a workaround):
This is not so much of an answer but a solution. For it to be an answer, I would need to know why I was having problems accessing the properties for a group withing a shape when there is more than one group. The solution was to redesign all the custom shapes to only have one group. once that was done, the code as listed above for setting the property values worked without issue.
The answer would be to have figured out how to reference nested group properties directly.
Thanks.
Michael