Solved

Macro substitucion in visual basic 2012

Posted on 2014-03-22
6
278 Views
Last Modified: 2014-04-03
Hello Experts,
is there any equivalent to visual fox macro substitution in visual basic 2012 ?
Regards,
0
Comment
Question by:rguillermo
6 Comments
 
LVL 39

Expert Comment

by:nutsch
ID: 39947788
Describe what that substitution does and I can try telling you if I know how to do it in vb.
0
 

Author Comment

by:rguillermo
ID: 39948130
Hi Nutsch,
macro substitucion means using the content of a variable as part of the code at execution time:
Example 1

a = "b"
&a = 10

suposing "&" sign is the macrosubstitution indicator.
Then at execution time &a will be replaced by the content of a
resulting in
b = 10 as the code executed.

Example 2
dim aa(2,2)
aa(1,1) = "w_cod"
aa(1,2) = "3543"
aa(2,1) = "w_nam"
aa(2,1) = "William"

for a = 1 to 2
  x = aa(a,1)
  &x = aa(a,2)
next a

Code executed in the loop will be
w_cod = "3543"
w_nam = "William"

Thanks !
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 250 total points
ID: 39949541
From what I read here:

    http://msdn.microsoft.com/en-us/library/4eabtddy(v=vs.80).aspx

...the closest thing would be the String.Format method.
0
 
LVL 45

Accepted Solution

by:
aikimark earned 250 total points
ID: 39965680
Instantiate a scripting.control object and put your 'macro' statements and use the results.  You can use the EVAL() function in this environment.

There is the possibility of creating a .Net program on-the-fly and have it compiled and executed.  I've never done this, but I think it is possible.
0
 

Author Closing Comment

by:rguillermo
ID: 39975862
Thank you very much!!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question