Bonjour,
Dans son message, < Kolmyk AE > écrivait :
In this message, < Kolmyk AE > wrote:
|| It is may be not so good:
|| For example,
|| 1. User works with document.
|| 2. He (or she) clicks menu item "Save Document in Database"
|| 3. I (or program) save document in temporary file, place this file in DB,
call Documents.Add
|| Template:="file.tmp", close old document and activate new document.
||
|| BUT! User Exvironment is gone (cursor position, selections, and so on)
||
|| May be I can somehow save and restore User Environment?
Forget my previous post, I thought the whole process was done
programmatically, I did not understand that the user was calling the "save"
procedure after having worked on the document.
Try something a little different then:
User clicks on "Save to database";
Program saves current document (optional);
Using "Documents.Add", create an invisible (unless you are working with Word
97) document from the same template the user's document was based on;
Using a range object, copy the content of the user document to the invisible
one;
Save the invisible document to the database;
Terminate the invisible document.
User is returned to his/her document without any apparent changes.
I have not tested this, but I think it is worth exploring...
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org