Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to open a word document using vb.net, need to disable options like FILE, HOME, INSERT, DESIGN, PAGE LAYOUT etc.

Kindly suggest vb.net code to disable top menu options in ms word/winword file.

Thanks & Regards,

Saurav Sinha

What I have tried:

I didn't get any useful links.
Posted
Updated 30-Jul-18 2:50am
Comments
Patrice T 30-Jul-18 7:17am    
What is the reason ?
Why do you want this ?
yash1507 30-Jul-18 7:46am    
The purpose for this post is that nobody can edit/delete contents of ms word file and nobody can create a copy of this ms word file.

Kindly suggest some vb.net code.

Thanks & Regards,

Saurav Sinha
Richard MacCutchan 30-Jul-18 7:47am    
Then do not provide them with the word file in the first place. Convert it to a PDF or similar. Or just create a view in your program that shows the Word data, but does not accept any commands to copy or modify it.
yash1507 30-Jul-18 7:52am    
Can you help me with the vb.net code..kindly provide if possible.

Thanks & Regards,
Saurav Sinha

Quote:
The purpose for this post is that nobody can edit/delete contents of ms word file

Then do not provide as a Word file ! Provide it as a pdf.
Quote:
nobody can create a copy of this ms word file.

As soon as it is displayed on screen, it is impossible.
The user just have to use the Capture tool to make copies of the screen.
And can't prevent the user from copying a file that is on its PC.
Quote:
Kindly suggest vb.net code to disable top menu options in ms word/winword file.

It is useless and at best it will annoy legitimate users.

[Update]
Quote:
Can you just provide me the vb.net code to disable "Save As" option in ms word file.

Which word you don't understand in 'it is impossible' ?
1) your app launch winword with the file and deactivate all what is needed:
The user only have to open the file manually and he do all what he wants.
2) the file embed an autostart macro
the user just have to disable the autostart macro.
3) you have locked winword, the user can't copy anything
The Capture tool will make pictures of the file.
4) File menu is disabled
keyboard shortcuts are still working
...
 
Share this answer
 
v2
Comments
yash1507 30-Jul-18 8:39am    
Can you just provide me the vb.net code to disable "Save As" option in ms word file.


Thanks & Regards,
Saurav Sinha
Dave Kreskowiak 30-Jul-18 11:55am    
You really think that's going to stop someone from making a copy of the file?

Hint: No, it's not.
There are no options to disable general menu items in Word as far as I know.

If you want to disallow editing, protect your document with a password:
Select "Save As - Tools - General Options" and set a "Password to modify" but not a "Password to open".

If you need further restrictions like disallow printing and copying of text you have to choose another document format that supports such like PDF.

Note also that once a file has been stored locally, it can be copied. There is no method to avoid that.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900