ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protecting a VBA Project from viewing (https://www.excelbanter.com/excel-programming/343523-protecting-vba-project-viewing.html)

William Benson[_3_]

Protecting a VBA Project from viewing
 
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



Leith Ross[_88_]

Protecting a VBA Project from viewing
 

Hello Bill,

If your company has such high concerns about program security, I would
suggest you look into developing a web based interface. Far less
expensive than many other options and provides with ablity to prevent
users from viewing or changing the code.

Sincerely,
Leith Ross


--
Leith Ross


------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=478438


William Benson[_3_]

Protecting a VBA Project from viewing
 
That's a thought but I don't know how to do that and I am only getting a
couple hundred for building this application as a standalone (and it's
basically done).

I appreciate your response, but at this juncture just trying to make sure it
is a unsolvable conundrum with the present methods.

The client is going to distribute this workbook to their clients, no web
hosting of the solution.

"Leith Ross" wrote
in message ...

Hello Bill,

If your company has such high concerns about program security, I would
suggest you look into developing a web based interface. Far less
expensive than many other options and provides with ablity to prevent
users from viewing or changing the code.

Sincerely,
Leith Ross


--
Leith Ross


------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=478438




Leith Ross[_90_]

Protecting a VBA Project from viewing
 

Hello Bill,

I guess you already have thought about using a password to protect th
workbook project. Not the securest measure, but it may be your best be
at this point. The combination of the password with a copyright notic
would be my choice to protect my work. I wish you well with th
project.

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=47843


Tim Williams

Protecting a VBA Project from viewing
 
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





William Benson[_3_]

Protecting a VBA Project from viewing
 
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







Norman Jones

Protecting a VBA Project from viewing
 
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









William Benson[_3_]

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











Norman Jones

Protecting a VBA Project from viewing
 
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













William Benson[_3_]

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
















All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com