"Literal Substitiution" Does it exist in VB3.0, VB 4.0 or VB 5.0?? 
Author Message
 "Literal Substitiution" Does it exist in VB3.0, VB 4.0 or VB 5.0??

I have been trying to add a feature to a VB3.0 App and know that having
literal substition available would make it practical to program. It is
as described in Visual FoxPro Help as Macro Substitution:

& Command

See Also                Example

Performs macro substitution.

Syntax

& MemVarName [.cExpression]

Arguments

& MemVarName

Specifies the name of the memory variable or array element to reference
in the macro
substitution. Do not include the M. prefix that distinguishes memory
variables from
fields. This causes a syntax error. The macro should not exceed the
maximum
statement length permitted in Visual FoxPro.
A variable cannot reference itself recursively in macro substitution.
For example, the
following generates an error message:

STORE '&gcX' TO gcX
? &gcX

Macro substitution statements that appear in DO WHILE, FOR, and SCAN are
only
evaluated at the start of the loop and are not reevaluated on subsequent
iterations.
Any changes to the memory variable or array element that occur within
the loop are
not recognized.

.cExpression

The optional period (.) delimiter and cExpression are used to append
additional
characters to a macro. cExpression appended to the macro with
.cExpression can
also be a macro.

Remarks

Macro substitution treats the contents of a memory variable or array
element as a
character string literal. When an ampersand (&) precedes a
Character-type memory
variable or array element, the contents of the variable or element
replace the macro
reference. You can use macro substitution in any command or function
that accepts a
character string literal.



Tue, 15 Feb 2000 03:00:00 GMT  
 "Literal Substitiution" Does it exist in VB3.0, VB 4.0 or VB 5.0??

Hi Stu:

Quote:
>I have been trying to add a feature to a VB3.0 App and know that having
>literal substition available would make it practical to program. It is
>as described in Visual FoxPro Help as Macro Substitution:

VB does not support macro substitution.  About the closest you could come to
this is to use a Select Case:

  Public Function MacroSubstitution(ByVal MacroName As String) As Variant
    Select Case MacroName
    Case "TestSub"
      Call TestSub
    Case "TestFunction"
      MacroSubstitution = TestFunction()
    ...etc
    End Select
  End Function

Hope this helps,

Doug.



Wed, 16 Feb 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB 5.0 "Telnet" - HELP

2. VB 5.0 "Telnet" - HELP

3. VB 4.0 : "Unknown error;Quitting"

4. VB and NT 4.0 registry "transience"

5. What exactly is VB 4.0 "a"?

6. VB 4.0 Bugs "enhancements"

7. Searching VB 4.0 "MDB Database Files"

8. "DIM res&" Works in VB 4.0 errors in VB 5.0

9. Parsing CSV strings like "Doe, John",33, "6'2"""

10. Parsing CSV strings like "Doe, John",33, "6'2"""

11. Doing "Stuff" in the background

12. Origin of "John Doe"

 

 
Powered by phpBB® Forum Software