Closing app without saving doc

Closing app without saving doc

Anonymous
Not applicable
1,124 Views
10 Replies
Message 1 of 11

Closing app without saving doc

Anonymous
Not applicable
I am opening a dwg file and printing it. Then I want to quit the app but I keep getting
MsgBox "Do you want to save the file."
No I don not want to save it, just close AutoCad!
Here's the code I've tried:
acadDoc.Close (False)
Also Tried
acadDoc.Save
acadDoc.Close (False)
acadApp.Application.Quit
Nothing seems to work! Can anyone show me the light?

Thanks,
Tonto66
0 Likes
1,125 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
Maybe try closing it from the documents
collection.


--
Rodney McManamy - President
MACSolids - Maximizing AutoCAD
Solids
website:
href="http://www.macsolids.com">www.macsolids.com


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am opening a dwg file and printing it. Then I want to quit the app but I keep
getting
MsgBox "Do you want to save the file."
No I don not want to
save it, just close AutoCad!
Here's the code I've tried:

      acadDoc.Close (False)
Also Tried

      acadDoc.Save

      acadDoc.Close (False)

      acadApp.Application.Quit
Nothing
seems to work! Can anyone show me the light?

Thanks,
Tonto66

0 Likes
Message 3 of 11

Anonymous
Not applicable
acadDoc.Close False

This works for me...notice no parens.
--
"Make the most of the best
and the least of the worst."
Robert Louis Stevenson

http://www.acadx.com


"Tonto66" wrote in message
news:f0c8581.-1@WebX.maYIadrTaRb...
> I am opening a dwg file and printing it. Then I want to quit the app but I
keep getting
> MsgBox "Do you want to save the file."
> No I don not want to save it, just close AutoCad!
> Here's the code I've tried:
> acadDoc.Close (False)
> Also Tried
> acadDoc.Save
> acadDoc.Close (False)
> acadApp.Application.Quit
> Nothing seems to work! Can anyone show me the light?
> Thanks,
> Tonto66
>
>
0 Likes
Message 4 of 11

Anonymous
Not applicable
Thanks for the response!
I am not creating a collection of documents.
I also tried:
acadDoc.Close False 'No parens
It did not work, runtime error '-2147417848(80010108) Automation Error

What ever that means 😉

Any other ideas?

Thanks,
Tonto66
0 Likes
Message 5 of 11

Anonymous
Not applicable
Can you show us some more code?
--
"Make the most of the best
and the least of the worst."
Robert Louis Stevenson

http://www.acadx.com
0 Likes
Message 6 of 11

Anonymous
Not applicable
Yes, Here ya go!
Dim acadApp As AcadApplication

Dim acadDoc As AcadDocument


Set acadApp = CreateObject("AutoCad.Application")

Set acadDoc = acadApp.ActiveDocument
acadDoc.Application.Documents.Open _
(sFolderName & "\" & sParsedDrawingName & ".dwg")

acadApp.Application.Visible = True
acadApp.ActiveDocument.Plot.PlotToDevice _
("D:\Program Files\ACAD2000\PLOTTERS\NED Image Printer Driver.pc3")
'Commented Out

' Do While acadDoc.GetVariable(Active) > 0

' Loop
' acadDoc.Close (False)

' Set acadApp = GetObject("AutoCad.Application")

' acadApp.Quit

'acadDoc.Close False

'Getting message when closing document

acadApp.Application.Quit

Set acadApp = Nothing

Let me know what ya think?
Thanks
Tonto66
0 Likes
Message 7 of 11

Anonymous
Not applicable
Sorry about how the prevoius post looks. I'm not sure how to get the formatting right on the forum. Any pointers?

Tonto66
0 Likes
Message 8 of 11

Anonymous
Not applicable
This is pulled from what I use to close acad. Just feed it the
acadapplication object and it will handle the rest. Of course it closes all
files without saving.

Public Sub closeAcad(acadApp As AcadApplication)
Dim cDocs As AcadDocuments
Dim aDoc As AcadDocument
Set cDocs = acadApp.Documents

For Each aDoc In cDocs
aDoc.Close False
Next aDoc

acadApp.Quit
Set acadApp = Nothing
End Sub
--
"Make the most of the best
and the least of the worst."
Robert Louis Stevenson

http://www.acadx.com
0 Likes
Message 9 of 11

Anonymous
Not applicable
That Works Great!!

Thanks a ton Bobby.

Tonto66
0 Likes
Message 10 of 11

Anonymous
Not applicable
I just got a chance to check back on this. 
What  Bobby gave you is what I meant.  THe documents collection is
always there.  It's a property of the AutoCAD
application.


--
Rodney McManamy - President
MACSolids - Maximizing AutoCAD
Solids
website:
href="http://www.macsolids.com">www.macsolids.com


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
That
Works Great!!

Thanks a ton Bobby.

Tonto66

0 Likes
Message 11 of 11

Anonymous
Not applicable
Thanks Everyone for your help!
Now off to start a new thread with a new problem!!

Tonto66
0 Likes