vb.net - Document.Save is Showing SaveAs Dialog -


i have visual studio 2010 vb.net 4.0 windows application project. code populating word 2010 document. there anywhere in region of 30 60 tables , anywhere in region of 30 50 embedded charts (all defined inline shapes (inlineshape)).

i had start putting in regular document.save() calls getting following error: there many edits in document. operation incomplete. save work.. there plenty of disk space available , memory also.

in cases, .save() works, randomly save dialog shown when .save() called. side note, if click cancel following error raised: command failed @ microsoft.office.interop.word.documentclass.save().

here extract of code give idea of going on:

imports _word = microsoft.office.interop.word ... ... dim wrd _word.application = createobject("word.application") wrd.visible = true wrd.screenupdating = true  dim doc _word.document = wrd.documents.open("c:\my-file-template.docx")  doc.application.displayalerts = _word.wdalertlevel.wdalertsnone doc.range.noproofing = true  dim reportfilepathname string = "c:\my-file.docx" if file.exists(reportfilepathname)     file.delete(me.reportfilepathname) end if doc.saveas2(reportfilepathname) ... 'numerous tasks carried out ... doc.save() 'this may or may not cause save dialog show ... 

does know why save dialog showing? can stop it?

is there reason why getting "too many edits" error , therefore don't need have many saves going on (which slowing process down anyway!)?

i have been messing extensively , come work around rather true fix. suspected real issue too many edits error. i've done more trawling , found this forum post - 4th post steve.

this did trick , stripped down little this:

imports _word = microsoft.office.interop.word ... public shared sub garbagecollect(byref doc _word.document)     doc.application.options.pagination = false     doc.undoclear()     doc.repaginate()     doc.application.screenupdating = true     doc.application.screenrefresh() end sub 

steve suggests scratch heap space has run out.

this got rid of too many edits in document error , subsequently able remove doc.save() entries - no more save dialog showing.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -