Making a doc "read-only"

T

Tammy

I am opening word documents from Access. Certain users
need to be able to edit the doc while others cannot.
What would be the best way to handle this? Currently I
have security set up on the database so that the users
cannot get into a certain menu - and am using (long to
short)that to determine who can open the doc for
editing. I read on the knowledge base that the VBA code
doesn't work as expected and that one should use Basic -
but I am not having any problems opening the doc's and
editing them. I am using:

oApp.ActiveDocument.ReadOnly = True
where "oApp" is set to "word.application"

I have also tried using ":=" versus just "=". I have
something wrong here, but I cannot figure out exactly
what it is?! Any pointers??

Thank you all so much for your help & time!
 
M

Michael Bednarek

I am opening word documents from Access. Certain users
need to be able to edit the doc while others cannot.
What would be the best way to handle this? Currently I
have security set up on the database so that the users
cannot get into a certain menu - and am using (long to
short)that to determine who can open the doc for
editing. I read on the knowledge base that the VBA code
doesn't work as expected and that one should use Basic -
but I am not having any problems opening the doc's and
editing them. I am using:

oApp.ActiveDocument.ReadOnly = True
where "oApp" is set to "word.application"

I have also tried using ":=" versus just "=". I have
something wrong here, but I cannot figure out exactly
what it is?! Any pointers??

From VBA Word Help:
======================================================================
ReadOnly Property

Document or RecentFile object: True if changes to the document cannot be
saved to the original document. Read/write Boolean for the RecentFile
object; read-only Boolean for the Document object.
^^^^^^^^^
======================================================================
Open Method

Syntax 1: Opens the specified document and adds it to the Documents
collection. Returns a Document object.

Syntax 1
expression.Open(FileName, ConfirmConversions, ReadOnly,
AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert,
WritePasswordDocument, WritePasswordTemplate, Format, Encoding, Visible)
======================================================================

Thus:
Set myDoc = oApp.Documents.Open(FileName:=strYourDocName,Readonly:=True)

However, there is no real security in this approach and its intent can
easily be defeated. If the files were appropiately protected at the file
system level, no special method would be necessary in VBA.
 
T

Tammy

I am embarassed to ask this (I am learning as I go here! -
obviously!)... but I'll ask anyway. I have very limited
knowledge in Word, mainly very basic usage! Please
forgive my ignorance!

When you say "system level" - do you mean security set in
word (by user level security) and/or saving the file as
read-only initially??? I will look into this... but I
would like to know if that is what you are referring to,
or if there is another (more efficient/effective) way
that I should look into!?

THANKS for your response so far! I do appreciate it!
 
M

Michael Bednarek

I am embarassed to ask this (I am learning as I go here! -
obviously!)... but I'll ask anyway. I have very limited
knowledge in Word, mainly very basic usage! Please
forgive my ignorance!

When you say "system level" - do you mean security set in
word (by user level security) and/or saving the file as
read-only initially??? I will look into this... but I
would like to know if that is what you are referring to,
or if there is another (more efficient/effective) way
that I should look into!?

THANKS for your response so far! I do appreciate it!

I assume the files are held on some kind of network - Microsoft, Novell,
Unix. That network will provide some mechanism to grant/deny various
kinds of access (read/write) to individuals/groups of users. That's where
Read-only rights should be assigned to the appropriate users. Talk to
your network administrator.
 
E

Ed

That can get difficult and very involved, Michael, when you're talking about
a relatively small "project group" (15-30 people) on a large network
(1500-2000 users) - especially when the project group size and composition
is subject to change seemingly at random and quite often. If reports are to
go to some group members as "For Your Information" only, while others
(managers and team leaders) are encouraged to make changes, but these sets
of names are subject to frequent change, having the network administration
involved is very cumbersome, to say the least. After all, some users may
have Read-Only-level access to one project, but require full permissions to
another.

My thoughts, Tammy, are that Read-Only is a relatively easy and fairly safe
way to go - as long as you're dealing with people who don't have ulterior
motives to deliberately mess with the info. See if management will appoint
someone as a "Data Administrator" (and if it's you, make sure you get paid
for it!), and any changes get funneled back through that person. The doc can
be opened, changes made, and the doc SavedAs a new doc, which then gets
routed to the Data Administrator who inputs changes. It's easier to give a
person a list of ever-changing instructions than to try and write code to
cover every possible circumstance.

HTH
Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top