I have a set of toolbars the are linked to LISP Files, and am attempting to pass parameters to a VBA Module But get the following error
Method 'Getstring' of object 'IIcadUtility' Failed
the lisp routine is as follows ;-
(defun c:TestRoutine (/ )
(command "-VBARUN" "TestRtn" "This" "Works")
)
The VBA Routine is as follows ;-
Sub TestRtn()
Dim Txt1 as String
Dim Txt2 as String
Txt1 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
MsgBox Txt1
MsgBox Txt2
End Sub
This should produce 2 msgboxes saying "This" and then "Works" when the icon is selected. However, the system errors on the line
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt1 contains "This", so that works.
Could you please let me know what is the problem.
#2
ENSIGN,
I am using the latest version of IntelliCAD and this works sometimes on my system.
You are experiencing the difference in speed between Lisp and VBA.
Lisp is an interpretative non-compiled language and VBA is compiled at runtime and executes faster than Lisp.
GetString Method was designed to halt execution of the program and obtain a string at the command prompt from the user.
Using GetString in this manner will produce erratic results depending on the speed of your computer.
I only use Lisp to run VBA programs.
------------------
Regards
John Finlay
I am using the latest version of IntelliCAD and this works sometimes on my system.
You are experiencing the difference in speed between Lisp and VBA.
Lisp is an interpretative non-compiled language and VBA is compiled at runtime and executes faster than Lisp.
GetString Method was designed to halt execution of the program and obtain a string at the command prompt from the user.
Using GetString in this manner will produce erratic results depending on the speed of your computer.
I only use Lisp to run VBA programs.
------------------
Regards
John Finlay
#3
Hi,
I am currently converting software from AutoCAD VBA to IntelliCAD VBA and the above routines allways works in that.
Is there any other way to pass parameters from LISP to VBA as i dont really want a seperate VBA routine for each icon (we have a lot of possible icons)
I usually pass the item type being placed on the CAD along with the start point and an angle of orientation.
ENSIGN
I am currently converting software from AutoCAD VBA to IntelliCAD VBA and the above routines allways works in that.
Is there any other way to pass parameters from LISP to VBA as i dont really want a seperate VBA routine for each icon (we have a lot of possible icons)
I usually pass the item type being placed on the CAD along with the start point and an angle of orientation.
ENSIGN
#4
ENSIGN,
On your toolbar try:
^C^C^C(setq a "Try");(setq b "This");(command "-VBARUN" "Module1.TestLVar" )
In VBA:
Sub TestLVar()
MsgBox "Lisp a = " & IntelliCAD.ActiveDocument.GetLispVariable("a")
MsgBox "Lisp b = " & IntelliCAD.ActiveDocument.GetLispVariable("b")
End Sub
This GetLispVariable was not available in AutoCAD 2000, I am not sure if this has since been added.
------------------
Regards
John Finlay
On your toolbar try:
^C^C^C(setq a "Try");(setq b "This");(command "-VBARUN" "Module1.TestLVar" )
In VBA:
Sub TestLVar()
MsgBox "Lisp a = " & IntelliCAD.ActiveDocument.GetLispVariable("a")
MsgBox "Lisp b = " & IntelliCAD.ActiveDocument.GetLispVariable("b")
End Sub
This GetLispVariable was not available in AutoCAD 2000, I am not sure if this has since been added.
------------------
Regards
John Finlay
#5
Hi,
I think you introduce in your vba routine
on error resume next it works fine I holpe
it help you.
Sub TestRtn()
on error resume next
Dim Txt1 as String
Dim Txt2 as String
Txt1 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
MsgBox Txt1
MsgBox Txt2
End Sub
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by ENSIGN:
<B>I have a set of toolbars the are linked to LISP Files, and am attempting to pass parameters to a VBA Module But get the following error
Method 'Getstring' of object 'IIcadUtility' Failed
the lisp routine is as follows ;-
(defun c:TestRoutine (/ )
(command "-VBARUN" "TestRtn" "This" "Works")
)
The VBA Routine is as follows ;-
Sub TestRtn()
Dim Txt1 as String
Dim Txt2 as String
Txt1 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
MsgBox Txt1
MsgBox Txt2
End Sub
This should produce 2 msgboxes saying "This" and then "Works" when the icon is selected. However, the system errors on the line
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt1 contains "This", so that works.
Could you please let me know what is the problem.</B><HR></BLOCKQUOTE>
I think you introduce in your vba routine
on error resume next it works fine I holpe
it help you.
Sub TestRtn()
on error resume next
Dim Txt1 as String
Dim Txt2 as String
Txt1 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
MsgBox Txt1
MsgBox Txt2
End Sub
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by ENSIGN:
<B>I have a set of toolbars the are linked to LISP Files, and am attempting to pass parameters to a VBA Module But get the following error
Method 'Getstring' of object 'IIcadUtility' Failed
the lisp routine is as follows ;-
(defun c:TestRoutine (/ )
(command "-VBARUN" "TestRtn" "This" "Works")
)
The VBA Routine is as follows ;-
Sub TestRtn()
Dim Txt1 as String
Dim Txt2 as String
Txt1 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
MsgBox Txt1
MsgBox Txt2
End Sub
This should produce 2 msgboxes saying "This" and then "Works" when the icon is selected. However, the system errors on the line
Txt2 = Intellicad.ActiveDocument.Utility.GetString(0)
Txt1 contains "This", so that works.
Could you please let me know what is the problem.</B><HR></BLOCKQUOTE>
#6
AHM,
I generally leave out error trapping out of my answers because it can lead to adding some 60% increase in the amount of code.
This may confuse the issue at hand.
On Error Resume Next is not needed to run my example on the latest version of IntelliCAD.
Are you experiencing difficulties?
------------------
Regards
John Finlay
I generally leave out error trapping out of my answers because it can lead to adding some 60% increase in the amount of code.
This may confuse the issue at hand.
On Error Resume Next is not needed to run my example on the latest version of IntelliCAD.
Are you experiencing difficulties?
------------------
Regards
John Finlay