Thread: Private Sub
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Private Sub

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


"Ronbo" wrote in message
...


"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy

"Bob Phillips" wrote in
message
...
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


"Tom Ogilvy" wrote in message
.. .
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.

--
Regards,
Tom Ogilvy

"Bob Phillips" wrote in message
...
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.

--
HTH

-------

Bob Phillips
"Ronbo" wrote in
message
...


"Norman Jones" wrote:

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



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

Thanks

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?







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.