PC Review


Reply
Thread Tools Rate Thread

Disable Macros through VBA

 
 
yspin@hotmail.com
Guest
Posts: n/a
 
      28th Jan 2007
HI,

I am trying to save as an excel workbook with macros but when the user
will open it after the save as i dont want the macros to work.

I have a form that kicks in in the Workbook_Open event, i dont want
this event to occur after the save as.

I know about Application.EnableEvents=False but if i use it it will
disable the macros all the time, i need to disable it only when the
user opens the copy after the save as.
I googled for it but couldnt find anything.

Thanks,

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      28th Jan 2007
Why not just set a flag in the code after the save that gets tested in the
macros, and the exit immediately if set.

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> HI,
>
> I am trying to save as an excel workbook with macros but when the user
> will open it after the save as i dont want the macros to work.
>
> I have a form that kicks in in the Workbook_Open event, i dont want
> this event to occur after the save as.
>
> I know about Application.EnableEvents=False but if i use it it will
> disable the macros all the time, i need to disable it only when the
> user opens the copy after the save as.
> I googled for it but couldnt find anything.
>
> Thanks,
>



 
Reply With Quote
 
yspin@hotmail.com
Guest
Posts: n/a
 
      29th Jan 2007
Bob,

Do you mean like testing the content of a cell or something?

Thanks,

On Jan 28, 7:27 pm, "Bob Phillips" <bob....@somewhere.com> wrote:
> Why not just set a flag in the code after the save that gets tested in the
> macros, and the exit immediately if set.
>
> --
> HTH
>
> Bob Phillips
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> <y...@hotmail.com> wrote in messagenews:(E-Mail Removed)...
>
>
>
> > HI,

>
> > I am trying to save as an excel workbook with macros but when the user
> > will open it after the save as i dont want the macros to work.

>
> > I have a form that kicks in in the Workbook_Open event, i dont want
> > this event to occur after the save as.

>
> > I know about Application.EnableEvents=False but if i use it it will
> > disable the macros all the time, i need to disable it only when the
> > user opens the copy after the save as.
> > I googled for it but couldnt find anything.

>
> > Thanks,- Hide quoted text -- Show quoted text -


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      29th Jan 2007
No, what I was referring to was a public global variable. I was suggesting a
variable as it would automatically re-initialise on next opening. The
problem with using a cell is that you would need to clear it before closing
the workbook.

--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Bob,
>
> Do you mean like testing the content of a cell or something?
>
> Thanks,
>
> On Jan 28, 7:27 pm, "Bob Phillips" <bob....@somewhere.com> wrote:
> > Why not just set a flag in the code after the save that gets tested in

the
> > macros, and the exit immediately if set.
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (there's no email, no snail mail, but somewhere should be gmail in my

addy)
> >
> > <y...@hotmail.com> wrote in

messagenews:(E-Mail Removed)...
> >
> >
> >
> > > HI,

> >
> > > I am trying to save as an excel workbook with macros but when the user
> > > will open it after the save as i dont want the macros to work.

> >
> > > I have a form that kicks in in the Workbook_Open event, i dont want
> > > this event to occur after the save as.

> >
> > > I know about Application.EnableEvents=False but if i use it it will
> > > disable the macros all the time, i need to disable it only when the
> > > user opens the copy after the save as.
> > > I googled for it but couldnt find anything.

> >
> > > Thanks,- Hide quoted text -- Show quoted text -

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word & Enable Macros and Disable macros Theresa Microsoft Word Document Management 1 29th Sep 2008 10:38 PM
"openinf file..."ENABLE MACROS...DISABLE MACROS" =?Utf-8?B?Ri4gTGF3cmVuY2UgS3VsY2hhcg==?= Microsoft Excel Misc 3 12th Sep 2006 10:33 AM
Removing Excel message to enable macros or disable macros =?Utf-8?B?Ym1pbGxlcjI2Mw==?= Microsoft Excel Misc 2 13th Oct 2004 02:39 PM
Doc has no macros, but I'm prompted to enable/disable macros Microsoft Word Document Management 2 7th Oct 2004 09:34 AM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Microsoft Excel Programming 5 24th Sep 2003 03:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:45 AM.