Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
R. Choate
 
Posts: n/a
Default Save - Yes / No / Cancel

But it won't do any of that if macros are disabled before the file is opened. With disabled macros, nothing will automatically
happen. People have wanted to circumvent this for years, but the ability to disable VBA code before a file is opened is the front
line of defense against malicious code. I saw your code, but if the person has code disabled to start with, none of your code will
do anything no matter how it is written.
--
RMC,CPA


"sparx" wrote in message
...

Hi again, follow the link to see what I mean regards forcing enabling
macro's ( It does NOT actually force you to enable macro's ) it simply
saves the file with a specific worksheet open and hides all your other
sheets - so when you next open the file and you select disable - then
you just switched off macro's and one of the macro's that makes all
worksheets visable is in that file - so you cant see the worksheets of
your file - great!!

http://www.danielklann.com/excel/for...be_enabled.htm

There is a download at the bottom of this webpage - it works a treat.

Sorry if I confused anybody reading my original post - when you disable
macro's - you disable macro's - this file does NOT switch them back on
if you disabled them at file startup.

Thanks for reply to my query - what wahappening in my file is this.
I have a beforesave function and now a beforeclose function - if you
save your file, it saves OK - if you then select close - it runs some
hide sheet macro - then the file just changed so then are asked to
overwrite existing file - you select yes and it keeps on going. The
answer to my question stops this from happening - this is the modified
vba.

Private Sub HideSheets()
Dim sht As Object

Application.ScreenUpdating = False

ThisWorkbook.Sheets("Sheet1").Visible = xlSheetVisible

For Each sht In ThisWorkbook.Sheets

If sht.name < "Sheet1" Then sht.Visible = xlSheetVeryHidden

Next sht

Application.ScreenUpdating = True

Application.EnableEvents = False
ThisWorkbook.Save
Application.EnableEvents = True

End Sub

Thanks


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=539543


  #2   Report Post  
Posted to microsoft.public.excel.misc
sparx
 
Posts: n/a
Default Save - Yes / No / Cancel


Hi, R. Choate. You are right - when you disable macro's at startup -
they wont work - but if they dont work then fine - the file dont work
but if they chose enable then one of the macro's ( on file close - not
save ) switches off all worksheets and makes only one display - then
you are asked to save - you select YES and you have just completed the
loop. When you next open the file if you select disable - the file
opens but to the last state the file saved in which was - the single
sheet being viewed. So guess what - the file cant display any other
worksheets because you didnt enable macro's. Why dont you download the
file as described elsewhere in these notes and see the function working
for yourself.
Sparx


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=539543

  #3   Report Post  
Posted to microsoft.public.excel.misc
Jon Peltier
 
Posts: n/a
Default Save - Yes / No / Cancel

What you should have said was "Encourage" (not "Force") people to enable
macros, then clarify that without macros enabled, the useful parts of the
workbook never become visible.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"sparx" wrote in
message ...

Hi, R. Choate. You are right - when you disable macro's at startup -
they wont work - but if they dont work then fine - the file dont work
but if they chose enable then one of the macro's ( on file close - not
save ) switches off all worksheets and makes only one display - then
you are asked to save - you select YES and you have just completed the
loop. When you next open the file if you select disable - the file
opens but to the last state the file saved in which was - the single
sheet being viewed. So guess what - the file cant display any other
worksheets because you didnt enable macro's. Why dont you download the
file as described elsewhere in these notes and see the function working
for yourself.
Sparx


--
sparx
------------------------------------------------------------------------
sparx's Profile:
http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=539543



Reply
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
can I cancel a save juls!1601 Excel Discussion (Misc queries) 2 February 16th 06 01:03 AM
Cancel user's changes but save other changes [email protected] Excel Discussion (Misc queries) 1 December 19th 05 12:09 PM
macro save a workbook whilst increasing file no shrek Excel Worksheet Functions 0 November 10th 05 02:40 PM
Save as Msg box Bob Umlas, Excel MVP Excel Discussion (Misc queries) 0 August 29th 05 09:56 PM
How to CANCEL file SAVE PROMPT when MACRO is running? Stuart Macro Muppet Excel Discussion (Misc queries) 3 August 11th 05 12:26 PM


All times are GMT +1. The time now is 11:01 AM.

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"