Private Sub

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I stop "Private Subs" in "ThisWorkbook" on opening from executing.

Thanks
 
Hi Ronbo,

I think you ned to give a little more detail.

For example, when do you want to prevent execution and why? Are there any
other salient factors?
 
Norman Jones said:
Hi Ronbo,

I think you ned to give a little more detail.

For example, when do you want to prevent execution and why? Are there any
other salient factors?


---
Regards,
Norman





Norman

1) I loved your response.

2) I appreciated your questions.

3) I was just getting ready to update my post by adding that if you do not
enable macros, you are done.

Where do we go from here?
 
What exactly is the question? Your addition doesn't answer Norman's
questions IMO.

The only event that fires on opening is workbook open. You cannot stop that
except by disabling macros, with the effect that no macros run. If you want
to stop a user from having access to your workbook if they disable macros,
you cannot, but you can take some mitigating action.
 
Bob,
That's what he said. If he disables macros it stops the code from
executing. So he was saying he found the answer himself.
 
Hi Tom,

I read it that way too, but he ended with

.... Where do we go from here?

That is where I got confused.

Bob
 
Based on the whole thread, I would say he was just being cute. Of course,
that is just my opinion.
 
Tom Ogilvy said:
Based on the whole thread, I would say he was just being cute. Of course,
that is just my opinion.

--
Regards,
Tom Ogilvy


First of all, let me state that what I am trying to do is protect my work. I know that this is not possible, but I am trying to make it as difficult as possible.

Through the help of this discussion group and individuals such as Tom and
Bob, I believe that I have created a workbook that would be very difficult to
obtain the formulas or code from (hopefully impossible, as a newbie I think
it is).

Since the worksheet is run/protected by routines I do not want to let
someone open it without macros running - by "Disable Macros" upon opening.

Thomas Ramel provided me a round about way to prevent one from opening w/o
macros with an addin procedure in Private Sub Workbook_Open. It works great.
If one clicks "Disable Macros" it stops. They are done.

However last night when trying to break into it (and I have no idea how to
do it) I did something that let me get into the workbook without enabling
macros. I do not know what I did but it seems to me that the workbook opened
without executing the code in "Private Sub Workbook_Open". Thus my question;

How do I stop "Private Subs" in "ThisWorkbook" on opening from executing.

I liked Norms response because I read it to question my intent with, "why
and are there any other salient (silent) factors". To many times I see
someone asking how to break into or bypass protection and someone here
provides answers. I believe that If someone wants to bypass protection, let
them figure it out on their own or better yet take it to their programming
professionals who can verify ownership and use their skills to open the
workbook.

As alway, thanks for your help and help in the past.
 
You can prevents events from occurring at startup by holding down
the SHIFT key when you open the workbook. Another way is to set
Application.EnableEvents = False before opening the workbook.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
I believe that If someone wants to bypass protection, let
them figure it out on their own or better yet take it to their programming
professionals who can verify ownership and use their skills to open the
workbook.

The problem is that the cat is already out of the bag. Excel's security is
weak, and there is enough information out in the public domain such that it
doesn't take much research to find out how to crack it.
 
Chip Pearson said:
You can prevents events from occurring at startup by holding down
the SHIFT key when you open the workbook. Another way is to set
Application.EnableEvents = False before opening the workbook.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




Chip:

Thanks for the suggestions. I maybe doing something wrong but I could not
get either to work. Which is of course what I want.

When holding down the SHIFT key when opening the workbook I get the error
message "Can not open Excel Add-in for Editing. Please Edit the Source Doc
Instead." Holding down the SHIFT key and clicking OK returns the error
message 4 times. Then the "Enable/Disable Macro" dialog box appears.
Holding down the SHIFT key and clicking "Disable" returns the error message
for 2 times and then stops trying to open the workbook. This is what I want
to happen(not opening) from the code in "Private Sub Workbook_Open"

I then opened a workbook and invoked "Application.EnableEvents = False.
Then I tried to open my protected workbook without macros and it did what I
want it to do, it stopped.

If you/anyone has any idea what I am doing wrong (hopefully nothing) I would
be interested. Otherwise I think I have wasted enough time on what must of
been a fluk last night.

Bob:

I know its out there and easy to find. Its just my opinion that it should
not be made easier.

Thanks to all.
Ronbo
 
Hi Ronbo,
I liked Norms response because I read it to question my intent with, "why
and are there any other salient (silent) factors".

Just for the record, I intentionally used "Salient" rather than your
interpreted silent.

I used salient in its dictionary defined sense:

standing out conspicuously, noticeable or striking: particularly noticeable
or important, striking, or relevant
 

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

Back
Top