?
Solved

Macro substitucion in visual basic 2012

Posted on 2014-03-22
6
Medium Priority
?
303 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
5 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 1000 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 46

Accepted Solution

by:
aikimark earned 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

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