Message 1 of 4
Runtime error

Not applicable
10-30-2003
09:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Okay heres the deal. I have this simple program (for now) that simply gets a few variables, prints them to a text file, starts a new drawing, and runs a LISP routine that simply reads those variables from the text file and presents an alert box that says HEY! I think It works. More code will be added to that later, to do a multitude of calculations and draw some stuff, but for now this is how I begin most VBA/LISP programs. I have several that work on the same concept, a VBA dialog box (or boxes) collect information, print it to a text file and then a LISP r5outine reads that information and performs the calculations and draws the object(s).
This one works fine but when I close AutoCAD after running it I get this message.
Microsoft Visual C++ Runtime Library
Runtime Error!
Program C:\Program Files\AutoCAD 2002\acad.exe
abnormal program termination
None of the other programs cause this, and I even get it when I have the LISP routine unload the VBA project.
The main VBA code is
[Private Sub CmdOkay_Click()
If CboNumPocks.Value <> "" Then
If CboNumPocks.Value Mod 2 > 0 Then
MsgBox "The number of pockets MUST be an even number.", _
vbExclamation, " Rollover Wheel ERROR!"
CboNumPocks.SetFocus
Exit Sub
Else
IntNumPocks = CboNumPocks.Value
End If
Else
MsgBox "You must enter the desired number of pockets!", vbExclamation, _
" Number of Pockets ERROR."
CboNumPocks.SetFocus
Exit Sub
End If
If CboRollDia.Value = "" Then
MsgBox "You must enter the desired roll diameter!", vbExclamation, _
" Roll Diameter ERROR."
CboRollDia.SetFocus
Exit Sub
Else
DblRollDia = CboRollDia.Value
End If
If TxtProdLong.Value = "" Then
MsgBox "You must enter the product length!", vbExclamation, _
" Product Length ERROR."
TxtProdLong.SetFocus
Exit Sub
Else
DblProdLong = TxtProdLong.Value
End If
If TxtProdWide.Value = "" Then
MsgBox "You must enter the product width!", vbExclamation, _
" Product Width ERROR."
TxtProdWide.SetFocus
Exit Sub
Else
DblProdWide = TxtProdWide.Value
End If
StrRollWheel = "C:\RollWheel.txt"
IntFileNum = FreeFile
Open StrRollWheel For Output As #IntFileNum
Print #IntFileNum, IntNumPocks
Print #IntFileNum, DblRollDia
Print #IntFileNum, DblProdLong
Print #IntFileNum, DblProdWide
Close
Unload Me
ThisDrawing.Application.Documents.Add ("L.dwt")
ThisDrawing.SendCommand "(if (not C:RollMe)(load ""RollMe"")) RollMe "
End
End Sub]
AND the LISP is
[(defun c:RollMe (/ A B C D File inspt)
(setq File (open "C://RollWheel.txt" "r"))
(setq A (read-line File))
(setq B (read-line File))
(setq C (read-line File))
(setq D (read-line File))
(close File)
(setq Inspt (getpoint "Select center Point; "))
(alert "HEY! I think it's working.")
(command "vbaunload" "h:/VBA Routines/RollOverWheels.dvb")
)]
Any ideas??
Thanks
Dave. K
This one works fine but when I close AutoCAD after running it I get this message.
Microsoft Visual C++ Runtime Library
Runtime Error!
Program C:\Program Files\AutoCAD 2002\acad.exe
abnormal program termination
None of the other programs cause this, and I even get it when I have the LISP routine unload the VBA project.
The main VBA code is
[Private Sub CmdOkay_Click()
If CboNumPocks.Value <> "" Then
If CboNumPocks.Value Mod 2 > 0 Then
MsgBox "The number of pockets MUST be an even number.", _
vbExclamation, " Rollover Wheel ERROR!"
CboNumPocks.SetFocus
Exit Sub
Else
IntNumPocks = CboNumPocks.Value
End If
Else
MsgBox "You must enter the desired number of pockets!", vbExclamation, _
" Number of Pockets ERROR."
CboNumPocks.SetFocus
Exit Sub
End If
If CboRollDia.Value = "" Then
MsgBox "You must enter the desired roll diameter!", vbExclamation, _
" Roll Diameter ERROR."
CboRollDia.SetFocus
Exit Sub
Else
DblRollDia = CboRollDia.Value
End If
If TxtProdLong.Value = "" Then
MsgBox "You must enter the product length!", vbExclamation, _
" Product Length ERROR."
TxtProdLong.SetFocus
Exit Sub
Else
DblProdLong = TxtProdLong.Value
End If
If TxtProdWide.Value = "" Then
MsgBox "You must enter the product width!", vbExclamation, _
" Product Width ERROR."
TxtProdWide.SetFocus
Exit Sub
Else
DblProdWide = TxtProdWide.Value
End If
StrRollWheel = "C:\RollWheel.txt"
IntFileNum = FreeFile
Open StrRollWheel For Output As #IntFileNum
Print #IntFileNum, IntNumPocks
Print #IntFileNum, DblRollDia
Print #IntFileNum, DblProdLong
Print #IntFileNum, DblProdWide
Close
Unload Me
ThisDrawing.Application.Documents.Add ("L.dwt")
ThisDrawing.SendCommand "(if (not C:RollMe)(load ""RollMe"")) RollMe "
End
End Sub]
AND the LISP is
[(defun c:RollMe (/ A B C D File inspt)
(setq File (open "C://RollWheel.txt" "r"))
(setq A (read-line File))
(setq B (read-line File))
(setq C (read-line File))
(setq D (read-line File))
(close File)
(setq Inspt (getpoint "Select center Point; "))
(alert "HEY! I think it's working.")
(command "vbaunload" "h:/VBA Routines/RollOverWheels.dvb")
)]
Any ideas??
Thanks
Dave. K