The trick is to write do file and use command line.
- Use VBA to write STATA do file. Example:
fnum = FreeFile() Open "PathtoDofile.do" For Output As fnum Print #fnum, "reg income educ" Close #fnum - Use VBA to run do file. Actually it’s VBA asking command line to ask STATA to do the do file.
Shell("Pathtowsestata.exe do PathtoDofile.do")