PDA

View Full Version : Prevent various functions in document



casweb
09-17-2011, 01:32 PM
HI folks,

I'm new to the forum and slowly working my way round vba
i've never ventured into vba code and could do with some help!!
I have a document (a membership list for a club) that i need to make available to a few folk, however i don't want them able to copy/paste/save or make any changes to it etc
i thought i'd managed to get most of it sorted out from a couple of posts after a bit of tweaking but i obviously did something wrong and it didn't quite work.
can't post links but it was knowledge base articles 373 and 379 that kinda helped.
after tweaking the 2 codes together a bit it was kinda working, however i still noticed that there was the ability to save and make changes to the document
can anyone help with how i can resolve this to the way i need it - in all my tweaking i've accidentally deleted the 'almost working' version and i can't get it to do the same thing again lol!!!!

Cheers in advance
Chris.

GTO
09-17-2011, 04:44 PM
Greetings Chris,

Let me be the first to welcome you to vbaexpress.:hi: I am sure that you will be glad that you joined, as in addition to great code and formula solutions, there are plenty of great folks here, who will go out their way to be helpful to anyone trying to learn. I hope you have a blast!

Here are the two links, just to make things a tad easier...

Disable Cut, Copy Paste by: Ken Puls
http://www.vbaexpress.com/kb/getarticle.php?kb_id=373
Force users to enable macros in a workbook by: Ken Puls
http://www.vbaexpress.com/kb/getarticle.php?kb_id=379

Now from the links it is clear that you are referring to a workbook as a document; so we indeed are looking to protect a workbook.

Now, I am not understanding, so far at least, as to:

If we do not want the users to be able to do anything except read it, why are we not just protecting the sheet(s) and making the wb read-only?

Mark

casweb
09-18-2011, 12:35 AM
Hi mark and thanks for the response.

The users I need to send the file to need restricted access. I don't want anyone copying the file or changing it in any way. I need to be able to control the changes made to the file.

Therefore I want to be able to prevent copy and paste of the data, as well as prevent save as, and save during working on it.

The file they are getting is an excerpt from my main file. Hope that explains it better

Are you meaning that in addition to 373 and 379, I should be just protecting the worksheet. I had tried that but I think I was getting something wrong in trying to put those 2 pieces of code together! (Thanks for updating the links, I need 5 posts before I can do it!)

I was getting a couple of ambiguities showing up, and not being 100% on what I was doing think I was putting things in the wrong place!

If someone could look at the 2 links and put them together how they should be, then I can at least look at it and see where I was going wrong :)

Cheers

casweb
09-18-2011, 12:38 AM
Should add that if there's an easier solution to all the above then I'm happy to look at it lol!

GTO
09-18-2011, 04:31 AM
Chris,

Sorry if I am missing some logic, but please help me think through this:


The users I need to send the file to need restricted access. I don't want anyone copying the file...

Now I fully admit that I have but 'layman' coding ability, and may the Almighty help you if you had to depend on me for a complex formula. That said, vba is not going to prevent copying any type of file. The most you may hope for is to make goobering up your hard work a bit of an inconvenience.


The users I need to send the file to need restricted access. I don't want anyone copying the file or changing it in any way. I need to be able to control the changes made to the file.

Therefore I want to be able to prevent copy and paste of the data, as well as prevent save as, and save during working on it.

Ehh?

Do you 'see' what I am asking? Are we trying to prevent all users from making (saved) changes, or are we tring to only allow certain users to make saves?

As to making the wb basically unusable unless macros are enabled:

What are the earliest and latest versions of Excel that the users will be using. This may take a bit, as I ran across a thread that indicated some issues in 2007 and thereafter. (Unfortunately, I did not save the link) As I recall, more code to handle if a/the wb was saved in x format.

Mark

Kenneth Hobs
09-18-2011, 05:36 AM
Why go to all of that trouble? Why don't you just save the sheet(s) as a PDF?

Paul_Hossler
09-18-2011, 12:07 PM
Should add that if there's an easier solution to all the above then I'm happy to look at it lol!

Assuming that your intent is to allow others to read the content but not make changes to the content, I'd just FileAs a PDF and send them that.

They will not be able to do Excel-type stuff on it, but that does not sound like something you want them to do anyway

If you send then a file of any kind (PDF, XLSX, DOCX, JPG, etc.) once it's on their computer, AFAIK they can rename, print, copy, etc. unless there's some DRM there like on purchased materials (eBooks, iTunes music, etc.)



Paul