Author Topic: Passing Variables  (Read 3065 times)

0 Members and 1 Guest are viewing this topic.

deegeecees

  • Guest
Passing Variables
« on: June 07, 2004, 01:30:17 PM »
Ok, I know this question has probably been asked, (and I did a search on this) is there a way to pass a variable from lisp to vba and vise versa?

Jeff_M

  • King Gator
  • Posts: 3998
  • C3D user & customizer
Passing Variables
« Reply #1 on: June 07, 2004, 02:39:45 PM »
Yes.

Search for the VLAX class code that allows the use of lisp in vba. Then set/read lisp variables in lisp & vba.

Jeff

deegeecees

  • Guest
Passing Variables
« Reply #2 on: June 07, 2004, 03:09:53 PM »
I'm not too familiar with vlisp, could you give me an example of how that would work? Lets say I have this in VBA:

dim test1 as string
test1 = "test"

Now, how could I retrieve the value of test1 in lisp?

Jeff_M

  • King Gator
  • Posts: 3998
  • C3D user & customizer
Passing Variables
« Reply #3 on: June 07, 2004, 04:18:47 PM »
Here's an example using the vlax class.
Code: [Select]

Sub test()
Dim vlax As New vlax
Dim strText As String
strText = "Hello there!"

vlax.SetLispSymbol "test", strText

End Sub


Running the above will allow the symbol "test" to be used in a lisp function. Typing !test at the command line yields this:

Command: !test
"Hello there!"

HTH,
Jeff

Jeff_M

  • King Gator
  • Posts: 3998
  • C3D user & customizer
Passing Variables
« Reply #4 on: June 07, 2004, 04:29:16 PM »
Or, to retrieve a lisp symbol.....
(setq test 1234.5432)

Code: [Select]

Sub test2()
Dim vlax As New vlax
Dim strText

strText = vlax.GetLispSymbol("test")
Debug.Print strText
End Sub

deegeecees

  • Guest
Passing Variables
« Reply #5 on: June 07, 2004, 04:29:29 PM »
Just what the doctor ordered! Thanks Jeff!

Jeff_M

  • King Gator
  • Posts: 3998
  • C3D user & customizer
Passing Variables
« Reply #6 on: June 07, 2004, 05:20:35 PM »
Glad I could help!