.NET

Reply
Active Contributor
xpeter88
Posts: 42
Registered: ‎11-14-2013
Message 1 of 2 (207 Views)

Drawing is busy while SaveAndClose acDoc.

207 Views, 1 Replies
01-28-2014 01:16 AM
Hi,
I am working on one macro that read drawing names from excel, opens it, do some modification. After that I would need to save and close active drawing. When I use expression acDoc.SaveAndClose(acDoc.Name)
I am getting g an error - drawing is busy. I can save the drawing use save as method without any problems but can save and close it. Do you know what could be an issue? Probably I have to release that drawing or make it active somehow.

Any help is welcome.

Many thanks,
Peter
*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 2 (187 Views)

Re: Drawing is busy while SaveAndClose acDoc.

01-28-2014 08:15 AM in reply to: xpeter88
Methink you have to use P/Invoke
[DllImport ("user32.dll")]
static extern IntPtr SetFocus (IntPtr hWnd);
// Then in the code after save as:
SetFocus (Application.DocumentManager.MdiActiveDocument.Window Handle);
Application.DocumentManager.MdiActiveDocument.CloseAndDiscard();
// not tested, just an idea
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.