Results 1 to 6 of 6

Thread: VBA code to close AutoCAD

  1. #1
    Member
    Join Date
    2007-07
    Location
    Central Missouri
    Posts
    17
    Login to Give a bone
    0

    Question VBA code to close AutoCAD

    I'm new to using VBA and I'm trying to write a code that will save and close all open drawings and then close AutoCAD. I've got it to save and close all drawings with the help of "A Tutorial in VBA for Beginners" By Richard L. Binning (Excellent article if you're just starting out if I do say) I modified his PurgeAll.dvb to save and close, but I can't seem to figure out how to get AutoCad to close. Any help would be great!!!

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: VBA code to close AutoCAD

    AcadApplication.Quit
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

  3. #3
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: VBA code to close AutoCAD

    Potential problem with that - the VBA will still be running while the application that is hosting it attempts to exit. Probably best to let the user handle closing the application.

  4. #4
    Member
    Join Date
    2007-07
    Location
    Central Missouri
    Posts
    17
    Login to Give a bone
    0

    Default Re: VBA code to close AutoCAD

    Quote Originally Posted by dgorsman View Post
    Potential problem with that - the VBA will still be running while the application that is hosting it attempts to exit. Probably best to let the user handle closing the application.

    Why exactly is that a problem? Like I said before I'm really new to the programming side of ACAD.

  5. #5
    Member
    Join Date
    2007-07
    Location
    Central Missouri
    Posts
    17
    Login to Give a bone
    0

    Default Re: VBA code to close AutoCAD

    Quote Originally Posted by RobertB View Post
    AcadApplication.Quit
    Worked Great!! Now another ?? How do I get this to automatically load when ever autocad starts? I don't want to have to load it everytime I want to run it.

  6. #6
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: VBA code to close AutoCAD

    This is described in the ActiveX and VBA Developer's Guide help file. Search for "acad.dvb".
    R. Robert Bell
    Design Technology Manager
    Stantec
    Opinions expressed are mine alone and do not reflect the views of Stantec.

Similar Threads

  1. 2014: AutoCAD will start and then close
    By rbhazie in forum AutoCAD General
    Replies: 4
    Last Post: 2014-10-01, 08:28 PM
  2. 2011: My profile keeps resetting when I close AutoCAD
    By tmad101185 in forum AutoCAD General
    Replies: 2
    Last Post: 2011-03-15, 12:00 PM
  3. Trace AutoCAD app close.
    By StormyC in forum AutoLISP
    Replies: 7
    Last Post: 2009-06-29, 02:46 PM
  4. Close an AutoCAD dialogue box in VBA
    By Mlabell in forum VBA/COM Interop
    Replies: 15
    Last Post: 2008-09-04, 02:12 PM
  5. Autocad does not close correctly
    By w.diesenreiter in forum AutoCAD General
    Replies: 5
    Last Post: 2008-01-16, 05:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •