Dispatch Template Dialog

G

Gary Shell

I am using the Cross Functional FlowChart Template to create a document in
the Visio Interop OCX using VB.NET. When I execute this code:

Me.AxDrawingControl1.Src = "Cross-functional Flowchart.vst"

I get a dialog box asking how many lanes and portrait vs. landscape
orientation. I always want to take the defaults and would like for my code
to dispense with this dialog. In VB6 this would be a messaging operation.
How is this best accomplished in VB.NET and the Visio Interop OCX?
Sendkeys? Surely there is a better way now.

Thanks,

Gary
 
M

Mark Nelson [MS]

Visio has a prescribed method for handling this, but I don't think that the
Cross-Functional add-on honors this property. Basically you want to set the
AlertResponse property of Visio. This is a property of the Application
object. Set the property to whatever default button you want to choose in
any dialog that pops up, such as IDOK. Then instead of showing the dialog,
Visio should skip it and follow whatever outcome you told it.
Unfortunately, not every add-on honors this property. You may have to send
your own Windows message to close the dialog.
 
G

Gary Shell

As you suspected the Cross-Functional add on does NOT honor the property.
<sigh> So now I guess I'll have to do some Windows Messaging to dispatch
the dialog. Having only done that in VB6, might you be able to point me to
a sample for VB.net??

Thanks,

Gary
 
G

Gary Shell

Follow-up:

I am executing the following code:

AppVisio = Me.AxDrawingControl1.Document.Application

'tell Visio to click OK to the dialog box
AppVisio.AlertResponse = 1

Me.AxDrawingControl1.Src = "Cross-functional Flowchart.vst"

'force the document to open
Application.DoEvents()

VisioVersion = Me.AxDrawingControl1.Document.Application.Version


Setting the SRC property does NOT force the template to open. I have to
execute the DoEvents before the template opens up and displays the Dialog.
But, since this template ignores the AlertResponse, my code does NOT regain
control until I click the OK in the dialog box the template displays. So I
am not sure how my code can even do the appropriate windows messaging to
dispatch the dialog. The dialog doesn't even show until the DoEvents is
executed and the VISIO template doesn't relinquish control back to my code
until the dialog is closed. I think I have a conundrum on my hands! <grin>

Thanks,
Gary
 

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