Solved

Macro substitucion in visual basic 2012

Posted on 2014-03-22
6
276 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 74

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
DataGridView 2 29
Visual Studio installation 5 39
Library to convert HTML to PDF. 8 45
VB.NET HttpWebRequest 12 32
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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now