Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Do Not Load if Not Using Auto-Execute Macro

If a user chooses to not enable macros and I have

Private Sub Workbook_Open()

which would start up when the file is opened, is it possible to have the
file open fail? In other words, if they don't start it with the macro, don't
let them in. Is that possible?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Do Not Load if Not Using Auto-Execute Macro

Have you tried it on a test sheet to see what happens.

Just a thought.

-Minitman

On Sun, 8 Jul 2007 07:26:01 -0700, Mike H.
wrote:

If a user chooses to not enable macros and I have

Private Sub Workbook_Open()

which would start up when the file is opened, is it possible to have the
file open fail? In other words, if they don't start it with the macro, don't
let them in. Is that possible?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default Do Not Load if Not Using Auto-Execute Macro

When a user chooses to not run macros there is no code executed so generally
nothing happens. That was the reason for my question. Is there a way around
this like not allowing the file to open?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Do Not Load if Not Using Auto-Execute Macro

One way comes to mind, Have the user open an entry workbook which
automatically opens the real workbook if macros are enabled (you will
have to have some little macro set to run so excel will require that
macros be enabled) and then closes the entry workbook leaving the real
workbook open and macros running. If macros are not enabled then only
the entry workbook will be open. You could have the first sheet have
instruction as to how to open the real workbook (eg. close this
workbook and reopen it with macros enabled). Another possibility,
hide all sheets except an opening default sheet with instructions as
closing and reopening with macros enabled. Then the first thing the
workbook open event does is hide the opening sheet (or change what it
is saying - Lots of possibilities here) and unhide the rest of the
workbook and any other opening events you might need.

I have not tried these myself yet. It is only a thought.

I hope this helps.

-Minitman


On Sun, 8 Jul 2007 13:36:01 -0700, Mike H.
wrote:

When a user chooses to not run macros there is no code executed so generally
nothing happens. That was the reason for my question. Is there a way around
this like not allowing the file to open?


  #5   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default Do Not Load if Not Using Auto-Execute Macro

Here's the code that I use to do exactly what you desire. Adjust to fit your
workbook.

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Dim n As Integer

Application.ScreenUpdating = False
For n = 2 To 24
Sheets(n).Visible = xlVeryHidden
Next
Application.ScreenUpdating = True

End Sub



"Minitman" wrote:

One way comes to mind, Have the user open an entry workbook which
automatically opens the real workbook if macros are enabled (you will
have to have some little macro set to run so excel will require that
macros be enabled) and then closes the entry workbook leaving the real
workbook open and macros running. If macros are not enabled then only
the entry workbook will be open. You could have the first sheet have
instruction as to how to open the real workbook (eg. close this
workbook and reopen it with macros enabled). Another possibility,
hide all sheets except an opening default sheet with instructions as
closing and reopening with macros enabled. Then the first thing the
workbook open event does is hide the opening sheet (or change what it
is saying - Lots of possibilities here) and unhide the rest of the
workbook and any other opening events you might need.

I have not tried these myself yet. It is only a thought.

I hope this helps.

-Minitman


On Sun, 8 Jul 2007 13:36:01 -0700, Mike H.
wrote:

When a user chooses to not run macros there is no code executed so generally
nothing happens. That was the reason for my question. Is there a way around
this like not allowing the file to open?



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
Auto Execute Macro dennis[_2_] Excel Discussion (Misc queries) 4 January 17th 09 04:47 PM
Auto Execute Macro dennis[_2_] Excel Worksheet Functions 4 January 17th 09 04:47 PM
Auto-execute macro.... Eric @ SEASH, Evansville Excel Discussion (Misc queries) 1 August 24th 05 09:32 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM
Auto execute a macro if a cell value=1 ? Sven[_4_] Excel Programming 1 November 14th 04 11:36 PM


All times are GMT +1. The time now is 02:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"