Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Specifically in Calc it can be a good idea to have a dedicated cell range somewhere which is used to pass someting like parameters to the Sub, and probably to branche the Sub depending on the values. The respective cells can even provide pre-calculated values depending on any content of the sheets. The Sub then only needs to know the range.

A means usable with any Form control is its .Tag property. Sometimes I used it regarding the URL-query syntax to pass a string to the called Sub which can be evaluated by the respective Sub itself or a helper. If I want to tell the called routine in what cell range to find more details I might enter ?indirect=true&sheetname=paramsheet&range=A2:B76
Direct parameters can also be passed this way: ?days1=even&startingtime=13h15min&maximum=123456

Specifically in Calc it can be a good idea to have a dedicated cell range somewhere which is used to pass someting like parameters to the Sub, and probably to branche branch the Sub depending on the values. The respective cells can even provide pre-calculated values depending on any content of the sheets. The Sub then only needs to know the range.

A means usable with any Form control is its .Tag the control's .Tag property. Sometimes I used it regarding the URL-query syntax to pass a string to the called Sub which can be evaluated by the respective Sub itself or a helper. helper sub. If I want to tell the called routine in what cell range to find more details I might enter ?indirect=true&sheetname=paramsheet&range=A2:B76
?indirect=true&sheetname=ParamSheet&range=A2:B76

Direct parameters can also be passed this way: ?days1=even&startingtime=13h15min&maximum=123456

The interpreting Sub only needs to check for the "?" (based on a first split probably), then split the final part by "&", and evey subpart then by "=" to get what it wants to know. The .Tag part in front of the "?" can be used then for another purpose.

Specifically in Calc it can be a good idea to have a dedicated cell range somewhere which is used to pass someting like parameters to the Sub, and probably to branch the Sub depending on the values. The respective cells can even provide pre-calculated values depending on any content of the sheets. The Sub then only needs to know the range.

A means usable with any Form control is the control's .Tag property. Sometimes I used it regarding the URL-query syntax to pass a string to the called Sub which can be evaluated by the respective Sub itself or a helper sub. If I want to tell the called routine in what cell range to find more details I might enter
?indirect=true&sheetname=ParamSheet&range=A2:B76
Direct parameters can also be passed this way: ?days1=even&startingtime=13h15min&maximum=123456

The interpreting Sub only needs to check for the "?" (based on a first split probably), then split the final part by "&", and evey subpart then by "=" to get what it wants to know. The .Tag part in front of the "?" can be used then for another purpose.

purpose.

In a similar way, just using a slightly adapted syntax, I sometimes passed parameters to an interpreting Sub by the name of a CellStyle when the Siub was called as the handler for the 'Content changed' event of a sheet.

Specifically in Calc it can be a good idea to have a dedicated cell range somewhere which is used to pass someting like parameters to the Sub, and probably to branch the Sub depending on the values. The respective cells can even provide pre-calculated values depending on any content of the sheets. The Sub then only needs to know the range.

A means usable with any Form control is the control's .Tag property. Sometimes I used it regarding the URL-query syntax to pass a string to the called Sub which can be evaluated by the respective Sub itself or a helper sub. If I want to tell the called routine in what cell range to find more details I might enter
?indirect=true&sheetname=ParamSheet&range=A2:B76
Direct parameters can also be passed this way: ?days1=even&startingtime=13h15min&maximum=123456

The interpreting Sub only needs to check for the "?" (based on a first split probably), then split the final part by "&", and evey subpart then by "=" to get what it wants to know. The .Tag part in front of the "?" can be used then for another purpose.

In a similar way, just using a slightly adapted syntax, I sometimes passed parameters to an interpreting Sub by the name of a CellStyle when the Siub Sub was called as the handler for the 'Content changed' event of a sheet.

Specifically in Calc it can be a good idea to have a dedicated cell range somewhere which is used to pass someting like parameters to the Sub, and probably to branch the Sub depending on the values. The respective cells can even provide pre-calculated values depending on any content of the sheets. The Sub then only needs to know the range.

A means usable with any Form control is the control's .Tag property. Sometimes I used it regarding the URL-query syntax to pass a string to the called Sub which can be evaluated by the respective Sub itself or a helper sub. If I want to tell the called routine in what cell range to find more details I might enter
?indirect=true&sheetname=ParamSheet&range=A2:B76
Direct parameters can also be passed this way: ?days1=even&startingtime=13h15min&maximum=123456

The interpreting Sub only needs to check for the "?" (based on a first split probably), then split the final part by "&", and evey subpart then by "=" to get what it wants to know. The .Tag part in front of the "?" can be used then for another purpose.

In a similar way, just using a slightly adapted syntax, I sometimes passed parameters to an interpreting Sub by the name of a CellStyle when the Sub was called as the handler for the 'Content changed' event of a sheet.

sheet.

===Edit1 2019-01-23:20 CET=== The .Tag property of a FormControl has a misleading name like "Additional information" in the object editor. From the code it is accessed as myControlObject.Tag anyway.