PDA

View Full Version : Using Macros/VBA to Manipulate File Menu and Open Dialog



markes1
06-10-2009, 11:44 AM
Is it possible to write a procedure where you can limit what File Menu options a user has when the MS Word document with the Macro/VBA loads? Is VBA the best technology to do this, or would it be some type of script (VBS, etc.)?

Also, is it possible to write a procedure where you can limit what documents a user could view/open (predicated on directory/file extension, etc.) within MS Word?

fumei
06-10-2009, 01:02 PM
"is it possible to write a procedure where you can limit what documents a user could view/open (predicated on directory/file extension, etc.) within MS Word?"

Not with any reliability. I know I could probably break any restrictions like (done in Word) in a few minutes. You are talking about Permissions really, and that is best handled by the OS, not Word. It is common and straightforward for systems admins to handle Permissions. If you have a real need to restrict access to files (of any kind), or folders, then using Permissions is the way to go.

"Is it possible to write a procedure where you can limit what File Menu options a user has when the MS Word document with the Macro/VBA loads?"

Yes...sort of. You can rather easily modify the menu. It takes a few seconds to, say, remove Page Setup from the menu. Alas, it only takes a few seconds to put it back.

Next, you can overwrite the Word command associated with a menu. Say, Page Setup. You can overwrite it, so that if someone clicks Page Setup (for example), they get a message:

"Page Setup is not available."

And it would not be.

Again though, a reasonably competent/knowledgeable person could get around that fairly easily.

Microsoft applications have never been, are not, and most likely never will be, really secure...to anything.

Which brings me to the real point...why do you want to do this? What is the business case for these restrictions?