visio recordsets

Started by perry59, April 16, 2024, 03:23:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

perry59

I am using some code I obtained from someone else and one of it's functions is to extract data from a recordset and insert it into a table however the moment it tries to do so I get an exception that states:
"This operation is not supported in Microsoft Visio Standard 2010."
But I am using visio 2016"
here is the code snippet:
 Try
            Select Case arg
                Case 0, 1 : FlagPage = arg : dlgNew = New dlgTableSize
                Case 2 : dlgNew = New dlgFromFile
                Case 3
                    If vsoApp.ActiveDocument.DataRecordsets.Count = 0 Then '<-bombs here
                        MsgBox("There are no external data connections available in the active document.", vbCritical, "Error")

                    End If
                    dlgNew = New dlgLinkData
                Case 4 : dlgNew = New dlgIntellInput
                Case 5 : dlgNew = New dlgPictures
                Case 6 : dlgNew = New dlgSelectFromList
                Case 7 : dlgNew = New dlgSortTable
            End Select

            dlgNew.ShowDialog()
            dlgNew = Nothing
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
Does anyone have any clue on how to fix this?
Thanks
what, me worry?

Thomas Winkel

External Data is not supported by Visio Standard.
You need Professional (or maybe 365 / Plan 2).

Try that in VBA:
Sub DrsTest()
    Debug.Print ActiveDocument.DataRecordsets.Count
End Sub
This should give the same error for your installation.

perry59

Indeed if I run that code in the VBA editor I get the same thing. Since the error message didn't even get my visio version right I was a bit skeptical of it.
I have a pro version at home, I'll see what happens there.
Thanks
what, me worry?

Yacine

But you don't need to rely on Visio's datarecordsets, you can use VBA's functions to connect directly with external datasets (Excel, databases, ...)
Yacine

Nikolay

Probably they just haven't updated the error message since Visio 2010.

perry59

#5
I don't get that error when I run it at home with the pro version, I just get an error there is no data. Now I'll have to relearn how to connect visio to external data. :)
what, me worry?