Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GPO GPO is offline
external usenet poster
 
Posts: 12
Default Making sure the user is able to run macros

I have an Excel application that contains macros. For it to function as
intended, the user's security settings need to allow macros to run. I'm
wondering how best to advise the user that they have not got macros enabled.
Is the following a legitimate approach?

On file open, the only visible sheet simply has a message on it saying
something like
"It appears that you have not enabled macros to run. Please enable macros in
order to use this workbook."

If the workbook_open() event can successfully fire, it will set the .visible
property from xlSheetVisible to xlSheetVeryHidden (I wanted
xlSuperDuperHidden but they don't have that yet) and set all the sheets I
want users to see from xlSheetVeryHidden to xlSheetVisible.

On Workbook_BeforeClose() reverse the process.

Are there any gotchas with this approach? It could also be a workaround for
people opening the file within Internet Explorer instead of saving it locally
and then opening it with Excel. Any advice gratefully received.

Cheers

GPO

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Making sure the user is able to run macros

GPO,

The gotcha has to do with how to handle saves. Basically you need to
capture every BeforeSave event and do your reversal there, so that each save
also inlcudes the reversal. Otherwise they could make some changes, save
the sheet, but not save at closing:

1 note which sheets are currently hidden
2 hide all the sheets except the notification sheet
3 do a save in the code
4 unhide the sheets that you just hid so the workbook looks the same
5 cancel the BeforeSave

hth,

Doug

"GPO" wrote in message
...
I have an Excel application that contains macros. For it to function as
intended, the user's security settings need to allow macros to run. I'm
wondering how best to advise the user that they have not got macros
enabled.
Is the following a legitimate approach?

On file open, the only visible sheet simply has a message on it saying
something like
"It appears that you have not enabled macros to run. Please enable macros
in
order to use this workbook."

If the workbook_open() event can successfully fire, it will set the
.visible
property from xlSheetVisible to xlSheetVeryHidden (I wanted
xlSuperDuperHidden but they don't have that yet) and set all the sheets I
want users to see from xlSheetVeryHidden to xlSheetVisible.

On Workbook_BeforeClose() reverse the process.

Are there any gotchas with this approach? It could also be a workaround
for
people opening the file within Internet Explorer instead of saving it
locally
and then opening it with Excel. Any advice gratefully received.

Cheers

GPO



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
Defining user access (via user id) using macros maruko Excel Discussion (Misc queries) 0 July 27th 09 02:44 AM
making NT user/login user appear in a cell [email protected] Excel Worksheet Functions 1 March 3rd 09 03:41 AM
Making a Form for User-friendly Macros? SeventFloorProfessor Excel Discussion (Misc queries) 1 January 17th 09 04:37 PM
Making a copy using macros legepe[_10_] Excel Programming 0 October 23rd 04 02:20 AM
Making excel macros run Word macros Matthew McManus Excel Programming 1 February 18th 04 02:57 AM


All times are GMT +1. The time now is 04:59 PM.

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"