Click to Rate and Give Feedback
MSDN
MSDN Library
Office Development
Visio 2007
Functions
 ARG Function
Community Content
In this section
Statistics Annotations (1)
ARG Function

Specifies an argument that the calling cell can pass to a custom function, as well as the default value returned by the custom function if the calling cell does not pass in a value for the argument. Returns the value specified by the calling cell and the matching argName parameter.

Syntax

ARG(argName,[defaultValue])

Parameters

NameRequired/OptionalData TypeDescription
argNameRequiredStringThe name of an argument that the calling cell can pass into the function.
default ValueOptionalThe value returned by ARG if the calling cell did not pass in a value for the argName parameter.

Remarks
As a shape developer, you can create custom functions by placing an expression in one cell and calling that expression from one or more other cells. The expression can include literal strings, ShapeSheet functions, and cell references. The expression can also include specific arguments that are passed in by the calling cell.

Remarks
The calling cell specifies the cell that contains the custom function as well as any arguments that it wants to pass to the function. The expression cell is evaluated and the result returned to the calling cell.

Example
The following example shows how to use the ARG function in conjunction with the EVALCELL function to find the middle value from a set of three values.

In the expression cell, place the following code that defines the custom function:

Visual Basic for Applications
User.MiddleValue = IF(ARG("A")>ARG("B"),IF(ARG("B")>ARG("C"),ARG("B"),IF(ARG("A")>ARG("C"),ARG("C"),ARG("A"))),IF(ARG("A")>ARG("C"),ARG("A"),IF(ARG("B")>ARG("C"),ARG("C"),ARG("B"))))
In the calling cells, place the following code that calls the custom function:
Visual Basic for Applications
User.Middle1 = EVALCELL(User.MiddleValue,"A",3,"B",9,"C",5)
User.Middle2 = EVALCELL(User.MiddleValue,"A",12,"B",0,"C",21)


Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
ARG Function Example - ShapeSheet User-defined Functions      greenlakechris   |   Edit   |   Show History

I've posted an article the shows an example of Visio 2007's user-defined function capability -- ie: using the new ARG and EVALCELL functions. You can find it here:

http://www.visguy.com/2007/01/01/user-defined-shapesheet-functions-in-visio-2007/

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker