View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
William Benson[_3_] William Benson[_3_] is offline
external usenet poster
 
Posts: 27
Default Protecting a VBA Project from viewing

Thanks Norman. I am running solver using SendKeys for now, because I cannot
run it with VBA because I cannot be sure there is a reference to the Solver
add-in on user machines. I am using the button approach, and unprotecting on
click, SendKeys to call solver, and reprotecting on
Worksheet_SelectionChange. I have no other way to reprotect because the user
has control once solver is launched. Certainly if I caould use VBA, it would
be simpler.

Bill
"Norman Jones" wrote in message
...
Hi Bill,

If Solver is run from VBA, try unprotectng / reprotecting the sheet around
the solver code.

If the user invokes Solver, consider providing access to Solver via a
button whose code performs the unprotect / reprotect steps.

---
Regards,
Norman


"William Benson" wrote in message
...
That is an interesting approach, and I will have to try it out. In the
meantime, another wrinkle: Solver will not work on a protected
worksheet.

What a roller coaster I have been on. I was so excited when I found I
could install solver with code, then found out it will not work on a
protected worksheet.

Then was excited when I found out I could invoke it while on an
unprotected sheet, then let down again when I got a message saying target
cell had to be on an active sheet.

There is no workaround for this, I don't think, but I am going to keep
chewing on it



"Tim Williams" <saxifrax@pacbell*dot*net wrote in message
...
You could always use two workbooks: one protected one with all the
"secret" stuff and one unprotected one which has the solver reference.
You could then expose the solver functions through the second workbook
to your code in the first one.

Caveat: never done this. But seems like it should work.

Tim.


"William Benson" wrote in
message ...
I need to protect a workbook's VBA project. But I do not know how to do
this while at the same time preserving the right to set and unset
references to dll's at runtime (My code adds the solver add-in and sets
a project reference to it). Not only that, I cannot let the user set a
reference manually and save the workbook, because I would have to give
them the VBA Project password in order to make this change.

I might save a workbook with reference already set, prior to
distributing, but I am sure that will result in broken links for some
users.

Can someone help me out of this Catch 22? My client does not want the
project viewable.

Is the answer to build compiled modules in an ActiveX.DLL? He doesn't
want to pay for that as of now.

Bill Benson