LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Protecting a VBA Project from viewing

Norman,

Sorry so late in getting back to this, and your helpful reference. The
bigger issue for me is that the VBA project is being protected, therefore I
cannot Add such reference "on the fly". It would have to be a hard-coded
reference, and that is what I meant by not being able to guarantee where it
is located.

Thanks for the help, I will certainly save that code in case my client
elects to let me hide the workbook functionality in a DLL, in which case I
would no longer need to lock the workbook, and then the DLL could contain
the reference-adding code you cited.

Bill

For Reference:

Sub SolverInstall()

'// Dana DeLouis
Dim wb As Workbook

On Error Resume Next
' Set a Reference to the workbook that will hold Solver
Set wb = ActiveWorkbook

With wb.VBProject.References
.Remove .Item("SOLVER")
End With

With AddIns("Solver Add-In")
.Installed = False
.Installed = True
wb.VBProject.References.AddFromFile .FullName
End With
End Sub
"Norman Jones" wrote in message
...

Hi Bill,


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



See the following suggestions from Dana DeLouis for VBA code to add a
reference to solver:

http://tinyurl.com/bmfmr

---
Regards,
Norman



"William Benson" wrote in message
...
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
















 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protecting Sheet to Prevent Viewing Aline Excel Discussion (Misc queries) 0 June 9th 08 05:54 PM
Protecting my formulas from viewing pillai Excel Discussion (Misc queries) 3 December 30th 07 05:55 PM
Protecting Sheet to Prevent Viewing At All Michael Link Excel Discussion (Misc queries) 9 September 25th 05 08:13 AM
Locking and unlocking a Excel project for viewing VJ Excel Programming 3 April 7th 05 09:33 PM
Protecting Add-In's from viewing Felix[_4_] Excel Programming 1 December 7th 03 08:07 PM


All times are GMT +1. The time now is 01:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"