×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

save, close and exit many autocad session with vba code

save, close and exit many autocad session with vba code

save, close and exit many autocad session with vba code

(OP)
Presently I’m searching a way to save, close and exit many autocad sessions in VBA. I have to look at the SDI and MDI mode.

 

I’m sure you will know someone who could help me?

 

Regards,

Steve

RE: save, close and exit many autocad session with vba code

Try the following code:

CODE

Sub CloseAcadSessions()
  Dim ACad As Object
  SessionIsOpen = True
  On Error Resume Next
  Do While SessionIsOpen
    Set ACad = GetObject(, "AutoCad.Application")
    If Err.Number <> 0 Then
    ' AutoCad is not running
      SessionIsOpen = False
    Else
      'AutoCad is running
      ACad.Quit
    End If
  Loop
  Err.Clear
  On Error GoTo 0
End Sub

RE: save, close and exit many autocad session with vba code

P.S.
To save the files that are open in each AutoCAD session insert the following code before the line:
ACad.Quit

CODE

      .....
      For Each Doc In ACad.Documents
        Doc.Close SaveChanges:=True
      Next
      ACad.Quit
      .....

DARE TO IMAGINE
mala_rs_singh@rediffmail.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources