GetResults on DocumentSheet

G

Guy..L

Is it possible to call GetResults on DocumentSheet shapes?

I've noticed I have to call the ParentObject.GetResults(ShapeIDs, etc.,
etc.) to get any results from cells in the Shapes. There is no such parent
for the DocumentSheet is there?

I always have an exception "Invalid Parameter" when I invoke
DocumentSheet.GetResults(...).
 
J

John Goldsmith_Visio_MVP

Hello Guy,

Yes it is. GetResults is a method on the Shape, Master and Page objects.
The DocumentSheet property of the Document object returns a Shape object, so
you're in luck. Have a look at this following code that I've adapted from
the SDK:

Public Sub GetResults_Example()

On Error GoTo HandleError

Dim intCounter As Integer
Dim aintSheetSectionRowColumn(1 To (3 * 4)) As Integer

aintSheetSectionRowColumn(1) = ActiveDocument.DocumentSheet.ID
aintSheetSectionRowColumn(2) = visSectionObject
aintSheetSectionRowColumn(3) = visRowDoc
aintSheetSectionRowColumn(4) = visDocPreviewQuality

aintSheetSectionRowColumn(5) = ActiveDocument.DocumentSheet.ID
aintSheetSectionRowColumn(6) = visSectionObject
aintSheetSectionRowColumn(7) = visRowDoc
aintSheetSectionRowColumn(8) = visDocOutputFormat

aintSheetSectionRowColumn(9) = ActiveDocument.DocumentSheet.ID
aintSheetSectionRowColumn(10) = visSectionObject
aintSheetSectionRowColumn(11) = visRowDoc
aintSheetSectionRowColumn(12) = visDocLangID

'Get first two values in inches. The second element in
'the units array is left uninitialized (empty) because we
'want the second result in the same units as the first
'result. The third result is initialized in degrees. Note that
'units can be expressed as a string or an integer constant.
Dim avarUnits(1 To 3) As Variant
avarUnits(1) = visNumber
'avarUnits(3) = visDegrees

'Return results of cells as an array of floating point numbers.
Dim avarResults() As Variant
ActiveDocument.DocumentSheet.GetResults aintSheetSectionRowColumn, _
visGetFloats, _
avarUnits, _
avarResults
For intCounter = 0 To 3
Debug.Print avarResults(intCounter)
Next

Exit Sub

HandleError:
MsgBox "Error"
Exit Sub

End Sub

As the exception says invalid parameter, you probably need to look a the
arrays you're passing into the GetResults method.

Hope that helps

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top