Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2023, 02:41 PM
fops fops is offline Dynamically protect word doc Windows 10 Dynamically protect word doc Office 2019
Novice
Dynamically protect word doc
 
Join Date: Mar 2023
Posts: 6
fops is on a distinguished road
Default Dynamically protect word doc

Hi,


as in topic, I want to dynamically protect the entire doc except the actual line where the corsor is.


I think of somthing like first evaluating the lines with:


linesInDoc = ActiveDocument.BuiltInDocumentProperties(wdPropert yLines)


or chars with:


charsInDoc = ActiveDocument.Characters.Count


and based on that inforamtion protect the document.


I have a doc with vba script which extends the doc everytime the doc is opened.


The script inserts a new line with timestamp and username and below that a user can type text.




The goal is, as stated above, to protect everything except the actual line for typing the next comment.


The doc looks like in attachment.


Thank you in advance!
fops
Attached Images
File Type: jpg doc1.jpg (58.0 KB, 15 views)
Reply With Quote
  #2  
Old 03-24-2023, 09:55 AM
Charles Kenyon Charles Kenyon is offline Dynamically protect word doc Windows 11 Dynamically protect word doc Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,116
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

You can apply the Group Content Control to the part before your line.
If you want to protect for forms, you need section breaks.
I do not recommend that.


What you want is, if I am understanding.
To insert a timestamp at the end of the document.
Allow the user to type anywhere after the timestamp and not before.
Am I correct?
What do you want to trigger the insertion of the timestamp? Opening the document? A macro or QAT button?
Reply With Quote
  #3  
Old 03-24-2023, 04:44 PM
fops fops is offline Dynamically protect word doc Windows 10 Dynamically protect word doc Office 2019
Novice
Dynamically protect word doc
 
Join Date: Mar 2023
Posts: 6
fops is on a distinguished road
Default

Hi,

first thank you for your reply.

Quote:
"What you want is, if I am understanding.
To insert a timestamp at the end of the document.
Allow the user to type anywhere after the timestamp and not before.
Am I correct?"
Yes exactly. Everytime the doc is reopened (Sub AutoOpen()) a new line with timestamp and username and an additional Selection.TypeText (Chr(11)) is inserted.
So im in the line below the timestamp.
Here a user can type comments.
What i want to protect is everything above the comment line where the user is actually typing.

When the doc is reopened the process shall start again, so the doc is growing:
timestamp -> comment ; timestamp -> comment ; ...
And everytime i want to protect everything above the actual comment line.

Quote:
What do you want to trigger the insertion of the timestamp? Opening the document?
Yes exactly, opening the document.


Thank you for replying to my post and also for your effort.

Greetings
Fops

Last edited by Charles Kenyon; 03-24-2023 at 08:58 PM. Reason: add quotation markers
Reply With Quote
  #4  
Old 03-24-2023, 08:59 PM
Charles Kenyon Charles Kenyon is offline Dynamically protect word doc Windows 11 Dynamically protect word doc Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,116
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

It is past my bedtime, but if someone else does not write the macro this weekend, I will.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically protect word doc How to dynamically grey out a button in customUI.xml in a ribbon of word ? Ddadoo57 Word VBA 2 03-13-2023 06:02 AM
How do I un-protect docs I didn't protect? doctorduncan Word 4 05-30-2019 11:09 AM
Dynamically protect word doc Dynamically changing drop-down list based on selection? (Word Form) laurarem Word 1 02-21-2013 10:17 PM
Dynamically protect word doc How to dynamically link imbedded Excel chart with source data from Word TBoz Excel 1 07-06-2012 05:53 PM
Dynamically protect word doc How do I dynamically update data in a Word Document from a database table RSchmidt Word 1 07-14-2011 04:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft