Map

Top  Previous  Next

Generates a new workbook or worksheet which sets out high-level map of the cells in the active workbook or worksheet.

Applies to

IOAKAddIn, IOAKAPI

SYNTAX

result1 = expression1.Map

Set result2 = expression2.Map(bookOrSheets, formulas, constants, constCopyValues, mapNamedRanges, mapArrays, outputTo, showLegend, colors)

expression1   Required.  An expression that returns an IOAKAddIn object.

expression2   Required.  An expression that returns an IOAKAPI object.

result1   An OAKResult enumeration indicating the success or otherwise of the action.

result2   The Workbook in which the worksheets generated or modified by the map action are to be found.  Will be a new workbook, or an existing one, depending on the value of outputTo.

bookOrSheets        Required Variant, containing either a workbook that is, or a collection or array of Worksheets that are, to be mapped by OAK.

formulas   Required MapComponents. Indicates which kinds of formulas in the workbook are to be marked on the map generated by OAK: those resulting in number, logical , text or error values.

constants   Required MapComponents. Indicates which kinds of constants in the workbook are to be marked on the map generated by OAK: those resulting in number, logical , text or error values.

constCopyValues   Required Boolean.  Indicates how constant values are to be shown on the map. True if the constants are themselves to be shown on the map. False if numeric values are indicated by #; text values by X, logical values by L, and error values by Err.

mapNamedRanges   Required Boolean.  True is named ranges in the workbook or worksheet(s) are to be marked on the map generated by OAK.  False if named ranges are not to be marked.

mapArrays   Required Boolean.  True if array formulas or constants in the workbook or worksheet(s) are to be marked on the map generated by OAK.  False if arrays are not to be marked.

outputTo Required MapOutput.  Indicates whether the map generated by OAK is to be presented in a new workbook, as new worksheets in the workbook being mapped, or is to be overlayed on the worksheets being mapped.

showLegend  Required Boolean.  True if OAK is to add alongside the worksheets bearing the generated maps an additional worksheet bearing a legend indicating the notation being used.  False if the legend worksheet is not to be generated.

colors  Required Scripting.Dictionary of MapColor to long, specifying a map item and its color.

Remarks

When applied to an IOAKAddIn object, the Map method activates the same dialog box as is presented when the Map Workbook/Worksheets command is selected manually from the OAK user interface.  The action that follows is controlled by the data gathered by the dialog box from the user, and acts on the workbook or worksheet(s) specified in that dialog.

When applied to an IOAKAPI object, the Map method generates a map identical to the one that would be generated by OAK if its Map Workbook/Worksheets command were activated manually from the user interface, but the details of the analysis, including the workbook or worksheet(s) to be mapped, are specified by the parameters submitted to the method.

OAK provides the means to change the color scheme used in the maps it generates.  The command that does this, OAK Development/Review | Options | Colors | Set map colors, is offered through the user interface.  The function is not accessible through the OAK API, but the Map method will use any colors specified by item. The Map method can override the these colors by supplying a Scripting.Dictionary for the optional colors parameter.

Example

To generate the most complete map (showing named ranges, arrays and every kind of formula and constant) of the active workbook:

Set MapWorkbook = MyOakApi.Map(ActiveWorkbook, MapComponents_All, MapComponents_All, True, True, True, MapOutput_NewWorkbook, True, Nothing)

To generate the same map, but overriding some of the colors:

Dim colors As Object
Set colors = CreateObject("Scripting.Dictionary")

' Override some of the map colors
colors.Add MapColor_Array, Win32Color(255, 0, 0) ' red arrays
colors.Add MapColor_NamedRange, Win32Color(0, 255, 0) ' green named ranges

Set MapWorkbook = MyOakApi.Map(ActiveWorkbook, MapComponents_All, MapComponents_All, True, True, True, MapOutput_NewWorkbook, True, colors)

For the Win32Color function, see the section titled: Colors in compare and map commands