Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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
 
Old August 23rd, 2009, 10:07 PM
Friend of Wrox
 
Join Date: Sep 2005
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)
 
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
 
Old September 5th, 2009, 10:45 AM
Friend of Wrox
 
Join Date: Sep 2005
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)
 
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
 
Old September 6th, 2009, 09:40 AM
Friend of Wrox
 
Join Date: Sep 2005
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)
The Following User Says Thank You to Shasur For This Useful Post:
IranianCuriousBoy (September 29th, 2009)





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.