_Ending a VBA-program nicely...

_Ending a VBA-program nicely...

serge
Advocate Advocate
338 Views
5 Replies
Message 1 of 6

_Ending a VBA-program nicely...

serge
Advocate
Advocate
I have an icon who's starting a VBA-program, behind the icon there is e.g. ^C^C^P(COMMAND "VBARUN" "MyVBAProg")... When I trigger somwhere in my VBA-program the END-statement, I get a 'Execution errornil'-message in the Command-line ... how can I avoid this ? ... Thanks ... SMD
DEVIDTS Serge, CAD Consultant
http://www.CADdICT.be
0 Likes
339 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
End will stop your program, yes, but right at that
point, if you have code in your .Terminate event, of your form to end cleanly,
then it's not executed.

 

So if you have a form close it first, otherwise I
think I would need some code examples.

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have an icon who's starting a VBA-program, behind the icon there is e.g.
^C^C^P(COMMAND "VBARUN" "MyVBAProg")... When I trigger somwhere in my
VBA-program the END-statement, I get a 'Execution errornil'-message in the
Command-line ... how can I avoid this ? ... Thanks ...
SMD
0 Likes
Message 3 of 6

Anonymous
Not applicable
SMD,

The problem is that when a lisp function ends it will always return nil. So to fix your problem, you should wrap you lisp in a defun

(defun c:myvbaprog ()
(vl-vbarun "MyVBAProg")
(princ)
)

Then in your icon use ^c^cmyvbaprog;

Kilo
0 Likes
Message 4 of 6

Anonymous
Not applicable
Unload Me?


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have an icon who's starting a VBA-program, behind the icon there is e.g.
^C^C^P(COMMAND "VBARUN" "MyVBAProg")... When I trigger somwhere in my
VBA-program the END-statement, I get a 'Execution errornil'-message in the
Command-line ... how can I avoid this ? ... Thanks ...
SMD
0 Likes
Message 5 of 6

serge
Advocate
Advocate
Works 100%, thanks !
DEVIDTS Serge, CAD Consultant
http://www.CADdICT.be
0 Likes
Message 6 of 6

Anonymous
Not applicable
Also, it would be better to use the Exit Sub/Function
statement instead of just End.


 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
have an icon who's starting a VBA-program, behind the icon there is e.g.
^C^C^P(COMMAND "VBARUN" "MyVBAProg")... When I trigger somwhere in my
VBA-program the END-statement, I get a 'Execution errornil'-message in the
Command-line ... how can I avoid this ? ... Thanks ...
SMD
0 Likes