I am trying to SaveAs the current open dwg with a new name, I try to use this code but it errors out saying eNotOpenForWrite and AutoCAD then crashes. This is the code I'm using, not sure what I'm missing.
Using curDb As Database = HostApplicationServices.WorkingDatabase
curDb.SaveAs(dirname, True, DwgVersion.Current, curDb.SecurityParameters)
End Using