mcguirepm Posted October 10, 2008 Posted October 10, 2008 I have a lisp routine that needs to call a VBA program and pass it an argument. This is what I have. (vl-vbarun (strcat "Gptoolbox.BlnEdit(" gron:lastent ")")) It throws no error, but doen't do anything either. Ideas? Quote
ASMI Posted October 10, 2008 Posted October 10, 2008 Visual LISP and VBA has incompatable data types and you cannot to call VBA function with lisp argument. You can to organize data interchange by a custom dictionary, therefore it is long and difficult way. May be use one programming language Visual LISP or VBA? Quote
swestbrook60 Posted October 13, 2008 Posted October 13, 2008 I have a lisp routine that needs to call a VBA program and pass it an argument. This is what I have. (vl-vbarun (strcat "Gptoolbox.BlnEdit(" gron:lastent ")")) It throws no error, but doen't do anything either. Ideas? There is a quick work-aroundif the amount of data is relatively small that you need to send the VBA routine and that is to use the USERS1 through USERS5 system variables. These are defined string variables defined by AutoCAD and available for use through LISP or VBA. In LISP you would do something like: (setvar "USERS1" sometext1) (setvar "USERS2" sometext2) (command "-vbaload" "Project") (command "-vbarun" "BlnEdit") (command "vbaunload" "Project") and then in VBA you would do: Dim var1, var2 As String var1 = ThisDrawing.GetVariable("USERS1") var2 = ThisDrawing.GetVariable("USERS2") With some manipulation of data type, you will be surprised how much info you can send back and forth. Hope this helps. Quote
ASMI Posted October 13, 2008 Posted October 13, 2008 > swestbrook60 It seems this guy want to call VBA program from this Viasual LISP code: http://www.cadtutor.net/forum/showthread.php?t=27872 . But it no need because he can make the same in VBA. P. S. USERXN variables usage is no good because its opened for any not authorised change. Dictionaries is best way to data transfer. Quote
swestbrook60 Posted October 13, 2008 Posted October 13, 2008 > swestbrook60 It seems this guy want to call VBA program from this Viasual LISP code: http://www.cadtutor.net/forum/showthread.php?t=27872 . But it no need because he can make the same in VBA. P. S. USERXN variables usage is no good because its opened for any not authorised change. Dictionaries is best way to data transfer. Your correct on both points, but the risk of the data in thre USERSX variables being corrupted are very minimal if any as long as they are treated as such. They are provided by AutoDesk for this particular reason and if you place your data there and then immediately go use that data, you will be safe. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.