Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 23rd, 2009, 03:35 AM
Registered User
 
Join Date: Aug 2009
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default How to protect VBA code

Hi
How can I protect VBA code from changing and even viewing by poeple who work with the Word document.
Thanks
Reply With Quote
  #2 (permalink)  
Old August 23rd, 2009, 10:07 PM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

You can do that as follows

From Tools menu of VBE select the Project's properties

VBE-->Tools-->Properties

Click the protection tab

Check the 'Lock project for viewing' dialog

Set the password for viewing in the text boxes

Save the project

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #3 (permalink)  
Old September 5th, 2009, 07:23 AM
Registered User
 
Join Date: Aug 2009
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Hi
Sorry for being late.
How reliable this method is? what's the probablity that this lock is broken?
and another question:
I've heard about a tool that make the code unreadable. for example it change the variable name 'Title' to 'HVKBmasc_sadc_vsac_sdac' or something longer that cannot be read. what are the name of these tools and how much do you know about them?
Thanks
Reply With Quote
  #4 (permalink)  
Old September 5th, 2009, 10:45 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

If you are really concerned about the code safety, then you can try for some compiled solutions. VBA code even though protected can be easily broken by external tools.

Try for creating some DLLs that are really safe and then you can use them in your VBA

All you will be doing is write the business logic in class library project adn compile them as a DLLs then use it in VBA project

Regards
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
  #5 (permalink)  
Old September 6th, 2009, 03:43 AM
Registered User
 
Join Date: Aug 2009
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Hi
1- Adding dll file is done this way? Tools->References->Browse
2- Is dll file embeded in doc file?
3- How can I compile a VBA file to dll file? I don't have VB 6 installed on my machine.
Thanks
Reply With Quote
  #6 (permalink)  
Old September 6th, 2009, 09:40 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

You have to create DLLs in Visual Basic and then you can include the DLLs in tools --> references

You can also try creating a solution using VSTO (which is .NET based)

Also have a look at http://msdn.microsoft.com/en-us/libr...ffice.10).aspx if this gives any help

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
The Following User Says Thank You to Shasur For This Useful Post:
IranianCuriousBoy (September 29th, 2009)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
protect my source code annumol JSP Basics 2 March 10th, 2008 07:24 AM
Protect / Unprotect Excel 97 - VBA Code - jlpazv Excel VBA 2 November 30th, 2007 10:54 AM
How to protect macro code? kotaiah Excel VBA 1 September 25th, 2006 02:57 PM
Protect my Code tamernice Pro VB.NET 2002/2003 1 May 14th, 2005 06:43 PM
Protect ACCESS CODE liviudiaconu Access VBA 1 February 6th, 2004 10:05 AM



All times are GMT -4. The time now is 06:54 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.