Toggle commands in automation - how do I use them?

P

Peter Smithson

Hi,

I need to disable the Visio 2007 AutoConnect feature (on by default).
I see that there's a method called DoCmd that I could call with a
parameter of visCmdAutoConnectToggle. Presumably this will toggle the
value.

But - I don't know what the value is so I don't know if it needs to be
toggled. i.e. Perhaps the user has already turned it off. How do I
get the value? Or is there some other way?

Thanks.

Peter.
 
J

John Goldsmith

Hello Peter,

The AutoConnect feature works at two levels: Application and Document. The
user turn the feature on and off via the "Tools/Options/General/Enable
AutoConnect" checkbox and this determines whether Visio uses it at all
across all documents. (Note that this can also be accessed programatically
via Application.Settings.EnableAutoConnect)

If the application level setting is set to True then inidividual documents
will contain a User cell (msvNoAutoConnect) that corresponds to the toolbar
button and visCmdAutoConnectToggle. So, if you want to turn off AutoConnect
you need to check firstly if the document contains this User cell and if it
does what it's set to. Have a go with the following code:

Dim vDoc As Visio.Document
Set vDoc = Application.ActiveDocument
If vDoc.DocumentSheet.SectionExists(visSectionUser, 0) = True Then
If vDoc.DocumentSheet.CellExistsU("User.msvNoAutoConnect", 0) = True
Then
vDoc.DocumentSheet.CellsU("User.msvNoAutoConnect") = True
End If
End If

Best regards

John


John Goldsmith
www.visualSignals.co.uk
 
P

Peter Smithson

Thanks for that. I'll give it a go.

Peter.

Hello Peter,

The AutoConnect feature works at two levels: Application and Document. The
user turn the feature on and off via the "Tools/Options/General/Enable
AutoConnect" checkbox and this determines whether Visio uses it at all
across all documents. (Note that this can also be accessed programatically
via Application.Settings.EnableAutoConnect)

If the application level setting is set to True then inidividual documents
will contain a User cell (msvNoAutoConnect) that corresponds to the toolbar
button and visCmdAutoConnectToggle. So, if you want to turn off AutoConnect
you need to check firstly if the document contains this User cell and if it
does what it's set to. Have a go with the following code:

Dim vDoc As Visio.Document
Set vDoc = Application.ActiveDocument
If vDoc.DocumentSheet.SectionExists(visSectionUser, 0) = True Then
If vDoc.DocumentSheet.CellExistsU("User.msvNoAutoConnect", 0) = True
Then
vDoc.DocumentSheet.CellsU("User.msvNoAutoConnect") = True
End If
End If

Best regards

John

John Goldsmithwww.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