Hy everyone,
I need help.
I want to make vba code that will set up password protection for opening word document, also that key for opening should be written on the document, because document is suposed to be printed and then taken to someone who would have to open the same document on some shared server and add some text. only person who get the document physicaly should be able to open the same document on web.
I have never programmed before in vba, and i would aprecieate any help.
Thanx
What do you mean by written on the document?
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
It should go like this.
After you save the document, or maybe easier when you open it, vba code generates some random number, writes it in first row of document, and that same number is password for opening document later. you print and save the document, put it on some shared folder. you take the printed document to some one who must sign it and maybe add some text in it, so if he wants to open it he must know the random number to open document.
I don't think that work, to get the password or open the document anyone can just not enable macros
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
i know, the word password is weak password. but this is for people who dont understand programming or computers, they just need to write few sentences print document, and after that open the same document using key on printed document. i know that with activedocument.password i can set up password, and range.insertbefore can insert the text
Not sure if this is what you mean. There's possibly better ways, I don't usually work with Word VBA
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
This could be very useful, thanx
I am having another idea, which could be simplier:
- in first row of document there is text box, and you type in the password in that text box, and after you save the document, that text becomes document's password
Is there a simple code for that?
solution with text box is much simplier. I only can't find syntax for taking text out of text box. so in code there should be :
...ActiveDocument.password = [[I]take text from textbox
Last edited by royUK; 07-12-2010 at 10:12 AM.
Try
And wrap your code with Code Tags in future please...ActiveDocument.password = Empty
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks