.NET

.NET

Reply
Active Contributor
42 Posts
0 Kudos
Registered: ‎11-14-2013
Post 1 of 2

Drawing is busy while SaveAndClose acDoc.

223 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*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 2 of 2

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
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!