Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Unauthorised Use Of Macro

I have an auto_close macro designed to reset toolbars etc.
once a user has finished with the workbook.

Is it possible to prevent users being able to run the
macro whilst the workbook is in use?

Many Thanks

Paul Moles
PS The code is protected using project properties, I am
trying to stop premature running.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Unauthorised Use Of Macro

Use the workbook_beforeclose event instead.

http://www.cpearson.com/excel/events.htm

Regards,
Tom Ogilvy


Paul Moles wrote in message
...
I have an auto_close macro designed to reset toolbars etc.
once a user has finished with the workbook.

Is it possible to prevent users being able to run the
macro whilst the workbook is in use?

Many Thanks

Paul Moles
PS The code is protected using project properties, I am
trying to stop premature running.



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Unauthorised Use Of Macro

Use the Workbook_BeforeClose event

Private Sub Workbook_BeforeClose(Cancel As Boolean)
auto_close macro here
End Sub

Lars Kofod

-----Original Message-----
I have an auto_close macro designed to reset toolbars

etc.
once a user has finished with the workbook.

Is it possible to prevent users being able to run the
macro whilst the workbook is in use?

Many Thanks

Paul Moles
PS The code is protected using project properties, I am
trying to stop premature running.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Unauthorised Use Of Macro

Correct, the user cannot run workbook_beforeclose. But have you ever
wondered why a user *can* run workbook_open directly from the VBE?

"Tom Ogilvy" wrote in message ...
Use the workbook_beforeclose event instead.

http://www.cpearson.com/excel/events.htm

Regards,
Tom Ogilvy


Paul Moles wrote in message
...
I have an auto_close macro designed to reset toolbars etc.
once a user has finished with the workbook.

Is it possible to prevent users being able to run the
macro whilst the workbook is in use?

Many Thanks

Paul Moles
PS The code is protected using project properties, I am
trying to stop premature running.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Unauthorised Use Of Macro

Hi Paul

What if the user want to have several open files simoultaneously ? I'd expect my toolbars
to look and work as always when I'm in the not-your-workbooks. Consider to use the
activate / deactivate events instead. Paste this in the ThisWorkbook module:

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
MsgBox "Active"
End Sub

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
MsgBox "Gone"
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Paul Moles" wrote in message
...
I have an auto_close macro designed to reset toolbars etc.
once a user has finished with the workbook.

Is it possible to prevent users being able to run the
macro whilst the workbook is in use?

Many Thanks

Paul Moles
PS The code is protected using project properties, I am
trying to stop premature running.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Unauthorised Use Of Macro

I always assumed it was because Workbook_Open() has no arguments.

You can certainly run this from the VBE:

Public Sub try()
Workbook_BeforeClose True
End Sub


In article ,
(onedaywhen) wrote:

Correct, the user cannot run workbook_beforeclose. But have you ever
wondered why a user *can* run workbook_open directly from the VBE?

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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Protect macro for unauthorised use Johan_vl2431 Excel Discussion (Misc queries) 2 May 3rd 07 04:56 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 08:32 PM.

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"