Solved

Question for qwaletee.

Posted on 2004-07-30
7
199 Views
Last Modified: 2013-12-18
RE: Changing file attaribute when exporting to word.

A follow-up for this please, why is WORD locking the exported document that it created and doesn't close it. From the previous question I already added
   wordobj.fileclose after it is saved. Why is it locking?
0
Comment
Question by:cyle
7 Comments
 
LVL 31

Expert Comment

by:qwaletee
ID: 11680156
Interesting.  I would set Word to visible, and see if it actually closes it.  (You may want to test with the fileclose commented out, so you see it staying open, then uncomment it, and see if it closes.)
0
 

Author Comment

by:cyle
ID: 11680195
When I try to actually save it again, it gives "Microsoft Word: Word cannot save this file because it is already open elsewhere."
0
 

Author Comment

by:cyle
ID: 11680361
I tried your suggestion. Now, I also tried to clean the folder and shut down my PC. Opened all application and created new data. This time word lets me save it, then I did the second time and saves it again but I noticed that when I open my word application to view the file it starts with Document2 and when I open the document I exported, word prompts "Do you want to revert the saved document ABC-123."  
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:cyle
ID: 11693359
Does anybody else have an idea why the word doc created is locking (Word is locking it!).
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 11695535
Did you try my suggestion to see if it is actually closing the document?
0
 
LVL 12

Accepted Solution

by:
fulscher earned 500 total points
ID: 11698526
I haven't read your previous post, since this is a new question.

Word keeps a lock on the document until you kill all instances of it:

Set wordobj = Nothing

Should do the trick.

You could also open another file; the previous file will then be unlocked, if I remember correctly.

Hope this helps
Jan
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11708226
I read your previous question. THere are two ways to do this.

1. Control the file attribute from the OS - in this case, if the user goes to explorer and modifies the file atribute, he will be able to save the document. SO this is not a fool-proof mechanism. However, that problem can also be worked out.

2. Control the file attribute from MS Word - In this case, your answer lies in the 6th parameter, WritePassword. While saving, you can assign a password to the file. Now you file is LOCKED. Untill the user knows the password, he/she can't edit the file. Not even by modifying attribute from the OS, because your document is locked by Word. Only a person who knows the password can edit the file in that case.

wordobj.filesaveas "c:\Work\SMP\" & CNno & ".doc"  , , , , , "PasswordToEditFile",True, , , , , True


0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now