Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use VBA to open word or excel, but disable their features

Status
Not open for further replies.

kp1279

Programmer
Jan 21, 2005
43
0
0
GB
Hi

I have an Access database project, with plenty of vb code.

What I have is code that will check the linked files, for their file extention, and open the correct programs for the file, and display those files.

Such as

.doc opens winword
.xls opens excel

etc etc

What I want to know is can I add anything to the code to open the application, but prevent features, such as save as, save, open etc, efectively making the application open in word, without any of the menu options, or the ability to edit the document.

Hope this makes sence



my code is:

shell(strapp, vbmaximizedfocus)

This opens the application and maximises the application, the application is decided through the system cross referencing the file extention against a file type table, and gives the system the application exe location or the shell command.

It might be as simple as adding a forward slah and code to the shell command, but can't figure it at the moment.


Many thanks for your help.
 
I think what you'll need to do is use the Word object and Excel object, and then look at what protection options you can set via code. So you could set the protection with a password to where the user would be required to enter the correct password to make changes. In Excel, you can protect the Worksheet or the whole workbook. You have a few levels of protection you can add, and on the worksheet end, you can also specify which cells to protect or not.
 
I am not sure, however, that you can prevent saving of the file in Word or Excel. If it is a report, you could save it to PDF format, and then use Adobe Acrobat Pro or Standard to edit the permissions to not allow saving of the document.
 
Does the user actually need to see the file? Otherwise you can stop the user from doing things by making the application invisible.
 
or, if possible, you can open them read only...

GComyn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top