How to open Properties on click

R

raven

How can I make a stencil to show it's properties with a single click (or
double-click).
 
D

David Parker [Visio MVP]

If you mean a shape, then you need to add =DOCMD(1312) into the
EventDblClick cell in the Events section of the shapsheet.
It is best to do this in the master, so that all copies will inherit this.
 
R

raven

Perfect. Thanks

David Parker said:
If you mean a shape, then you need to add =DOCMD(1312) into the
EventDblClick cell in the Events section of the shapsheet.
It is best to do this in the master, so that all copies will inherit this.
 
T

TechAuthorAndy

Quick question on this.
David - is there a similar method of displaying the Custom Properties window
as opposed to the dialog box?
 
A

AlEdlund

try 1658, since that is the visCmdCustProp (visio.visuicmds in the object
browser).
al
 
T

TechAuthorAndy

Hi Al,
Thanks for that. 1658 won't work from the shapesheet unfortunately.
Cheers,
Andy
 
A

AlEdlund

You might try it as a macro and then call the macro from the shape sheet.
(assumption by stencil you mean the shape).

'test macro in document
Public Sub myDoCmd()
Application.DoCmd (1658)
End Sub

'in place of the docmd in the dblclick event
="RUNADDON(""thisdocument.myDoCmd"")"

al
 
T

TechAuthorAndy

Thank you Al. Got it working a treat now.

AlEdlund said:
You might try it as a macro and then call the macro from the shape sheet.
(assumption by stencil you mean the shape).

'test macro in document
Public Sub myDoCmd()
Application.DoCmd (1658)
End Sub

'in place of the docmd in the dblclick event
="RUNADDON(""thisdocument.myDoCmd"")"

al
 
T

TechAuthorAndy

Hi Al,

Sorry to drag this up again.
I tried to clean things up here by relocating that macro to a stencil, but I
can only get the macro to run if it exists in a drawing's module1. If the
macro is located say in the ThisDocument module of a stencil called Andy.vss,
what would be the RUNMACRO syntax to call this macro from the shapesheet?
Eg I'd expected something like "RUNMACRO (Andy!ThisDocument.myDoCmd)" to
work, but sadly not.
Many thanks in advance.
 
D

David J Parker [MVP Visio]

I have copied the help contents from the Visio SDK below, but I would add
the following example:

=RUNMACRO("Module1.RunThis","Stencil2")

because ThisDocument is a Class not a Module

RUNMACRO:
Calls a macro in a Microsoft Visual Basic for Applications (VBA) project.

RUNMACRO (macroname [, projname_opt])

macroname Required string. The name of the macro to call.

projname_opt Optional string. The project that contains the macro.
Remarks
If a project is specified, Microsoft Office Visio scans all open documents
for the one containing projname_opt and calls macroname in that project. If
projname_opt is omitted or null (""), macroname is assumed to be in the VBA
project of the document that contains the RUNMACRO formula being evaluated.

The RUNMACRO function differs from the CALLTHIS function in that it does not
pass a reference to the shape that owns the formula being evaluated to
macroname. Like CALLTHIS, the RUNMACRO function doesn't require a reference
to projname_opt to call into it.

Note
VBA code that is invoked when the Visio instance evaluates a RUNMACRO
function in a formula should not close the document containing the cell
using the function because an application error results and Visio
terminates.

If you need to close the document containing the cell that uses the RUNMACRO
function, use one of the following techniques:


Close the document from code that is not VBA.
Close the document from a project other than the one that is closing.
Post window messages to close windows in the document rather than closing
the document.

For more information about running code in Visio, see About security
settings and running code in Visio in this ShapeSheet Reference.

Example
The following example invokes a macro called MyTest in the ThisDocument
class module of the VBA project containing the RUNMACRO formula.

RUNMACRO ("ThisDocument.MyTest")
 
T

TechAuthorAndy

Apologies for not replying sooner. I forgot to select the response
notification button. Doh! Anyway thanks a lot, David. I haven't had a chance
to try this yet, but will feedback when I do. Cheers, Andy.

David J Parker said:
I have copied the help contents from the Visio SDK below, but I would add
the following example:

=RUNMACRO("Module1.RunThis","Stencil2")

because ThisDocument is a Class not a Module

RUNMACRO:
Calls a macro in a Microsoft Visual Basic for Applications (VBA) project.

RUNMACRO (macroname [, projname_opt])

macroname Required string. The name of the macro to call.

projname_opt Optional string. The project that contains the macro.
Remarks
If a project is specified, Microsoft Office Visio scans all open documents
for the one containing projname_opt and calls macroname in that project. If
projname_opt is omitted or null (""), macroname is assumed to be in the VBA
project of the document that contains the RUNMACRO formula being evaluated.

The RUNMACRO function differs from the CALLTHIS function in that it does not
pass a reference to the shape that owns the formula being evaluated to
macroname. Like CALLTHIS, the RUNMACRO function doesn't require a reference
to projname_opt to call into it.

Note
VBA code that is invoked when the Visio instance evaluates a RUNMACRO
function in a formula should not close the document containing the cell
using the function because an application error results and Visio
terminates.

If you need to close the document containing the cell that uses the RUNMACRO
function, use one of the following techniques:


Close the document from code that is not VBA.
Close the document from a project other than the one that is closing.
Post window messages to close windows in the document rather than closing
the document.

For more information about running code in Visio, see About security
settings and running code in Visio in this ShapeSheet Reference.

Example
The following example invokes a macro called MyTest in the ThisDocument
class module of the VBA project containing the RUNMACRO formula.

RUNMACRO ("ThisDocument.MyTest")





TechAuthorAndy said:
Hi Al,

Sorry to drag this up again.
I tried to clean things up here by relocating that macro to a stencil, but
I
can only get the macro to run if it exists in a drawing's module1. If the
macro is located say in the ThisDocument module of a stencil called
Andy.vss,
what would be the RUNMACRO syntax to call this macro from the shapesheet?
Eg I'd expected something like "RUNMACRO (Andy!ThisDocument.myDoCmd)" to
work, but sadly not.
Many thanks in advance.
 
T

TechAuthorAndy

As mentioned in my previous post, I thought it might be useful to feedback on
this and post how I got it to work (thanks to David's pointers).

My EventDblClick formula looks like this:
=RUNMACRO("ThisDocument.myDoCmd","TEST")

This is running a macro called 'myDoCmd', which is located in the
'ThisDocument' module of a stencil called 'TEST'.

Cheers,


Andy



TechAuthorAndy said:
Apologies for not replying sooner. I forgot to select the response
notification button. Doh! Anyway thanks a lot, David. I haven't had a chance
to try this yet, but will feedback when I do. Cheers, Andy.

David J Parker said:
I have copied the help contents from the Visio SDK below, but I would add
the following example:

=RUNMACRO("Module1.RunThis","Stencil2")

because ThisDocument is a Class not a Module

RUNMACRO:
Calls a macro in a Microsoft Visual Basic for Applications (VBA) project.

RUNMACRO (macroname [, projname_opt])

macroname Required string. The name of the macro to call.

projname_opt Optional string. The project that contains the macro.
Remarks
If a project is specified, Microsoft Office Visio scans all open documents
for the one containing projname_opt and calls macroname in that project. If
projname_opt is omitted or null (""), macroname is assumed to be in the VBA
project of the document that contains the RUNMACRO formula being evaluated.

The RUNMACRO function differs from the CALLTHIS function in that it does not
pass a reference to the shape that owns the formula being evaluated to
macroname. Like CALLTHIS, the RUNMACRO function doesn't require a reference
to projname_opt to call into it.

Note
VBA code that is invoked when the Visio instance evaluates a RUNMACRO
function in a formula should not close the document containing the cell
using the function because an application error results and Visio
terminates.

If you need to close the document containing the cell that uses the RUNMACRO
function, use one of the following techniques:


Close the document from code that is not VBA.
Close the document from a project other than the one that is closing.
Post window messages to close windows in the document rather than closing
the document.

For more information about running code in Visio, see About security
settings and running code in Visio in this ShapeSheet Reference.

Example
The following example invokes a macro called MyTest in the ThisDocument
class module of the VBA project containing the RUNMACRO formula.

RUNMACRO ("ThisDocument.MyTest")





TechAuthorAndy said:
Hi Al,

Sorry to drag this up again.
I tried to clean things up here by relocating that macro to a stencil, but
I
can only get the macro to run if it exists in a drawing's module1. If the
macro is located say in the ThisDocument module of a stencil called
Andy.vss,
what would be the RUNMACRO syntax to call this macro from the shapesheet?
Eg I'd expected something like "RUNMACRO (Andy!ThisDocument.myDoCmd)" to
work, but sadly not.
Many thanks in advance.

:

You might try it as a macro and then call the macro from the shape sheet.
(assumption by stencil you mean the shape).

'test macro in document
Public Sub myDoCmd()
Application.DoCmd (1658)
End Sub

'in place of the docmd in the dblclick event
="RUNADDON(""thisdocument.myDoCmd"")"

al

Hi Al,
Thanks for that. 1658 won't work from the shapesheet unfortunately.
Cheers,
Andy

:

try 1658, since that is the visCmdCustProp (visio.visuicmds in the
object
browser).
al


Quick question on this.
David - is there a similar method of displaying the Custom
Properties
window
as opposed to the dialog box?

:

If you mean a shape, then you need to add =DOCMD(1312) into the
EventDblClick cell in the Events section of the shapsheet.
It is best to do this in the master, so that all copies will
inherit
this.

How can I make a stencil to show it's properties with a single
click
(or
double-click).
 

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