How do I protect my code?

H

HS

Hello everybody

I'm a freelancer and I created an excel sheet with some vba code for my
client.

I protected the VBA with password.

Now the client wants to be able to create his own macro as well , but he
gets this password protection.

So is it possible to just protect my vba code and let him create his macros?

Thanks
 
D

Dave Peterson

Not in the same workbook project.

Maybe you can move your code into an addin and protect that the way you want.

Or ask him to put his macro into another workbook and use alt-f8 to run it.
 
H

HS

Hello Dave

Thanks for the reply.

Can you help me as to

1) How to make my macro as an add in?

2) How to run macro from another workbook using Alt + F8

Thanks
 
D

Dave Peterson

#1. First, you'd want to separate your VBA code from the workbook that contains
the data.

Then use File|SaveAs to save that workbook with the VBA code as an addin.
There's a choice in the "save as type" dropdown box in the File|SaveAs Dialog
box.

You may need to give the user a way to execute the subroutines in your addin.
(They won't show up in the Tools|Macro|macros (or alt-F8) list.)

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

And if you use xl2007:

If you want to learn about modifying the ribbon, you can start at Ron de Bruin's
site:
http://www.rondebruin.nl/ribbon.htm
http://www.rondebruin.nl/qat.htm -- For macros for all workbooks (saved as an
addin)
or
http://www.rondebruin.nl/2007addin.htm

In xl2007, those toolbars and menu modifications will show up under the addins.

==============
#2. Just open the other workbook and activate the workbook & worksheet that
needs the macro to run (probably). Then hit alt-F8 or Tools|Macro|Macros and
select from the list and hit the run button.
 
H

HS

Hey Dave

Thanks for the prompt reply!

I got the addin part..

Now there is no code in my workbook and I have an add in.

But how do I execute it??

What I had is two macros.

And there were two images on the excel sheet, which ran them, when it was
clicked on.

Now, how do I run the macro in the addin by clicking on the image?

Thanks...
 
D

Dave Peterson

I wouldn't use the images on the worksheet to run the macros.

I'd use a toolbar.


Hey Dave

Thanks for the prompt reply!

I got the addin part..

Now there is no code in my workbook and I have an add in.

But how do I execute it??

What I had is two macros.

And there were two images on the excel sheet, which ran them, when it was
clicked on.

Now, how do I run the macro in the addin by clicking on the image?

Thanks...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top