Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default Identify when a user attempts to turn on "Allow cell drag and drop"


Hi All,

I have a workbook where we have disabled "Allow cell drag and drop".

I would like to be able to stop users from re-enabling it manually
from the Tools - Options menu.

Is that possible?


I know I can disable it using VBA by the following line:

Application.CellDragAndDrop = False


My problem is that I don't know when it has been changed manually by a
user?

I guess I actually either one of:

1) Stop it happening by disabling it entirely so users cannot
re-enable OR

2) Catch the re-enabling 'event' and trigger code that re-disables it
immediately.


Thanks for any suggestions.

Alan.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Identify when a user attempts to turn on "Allow cell drag and drop"

The only way I an think of is to use OnTIme macros to disable the
preference every so often.

There's no event that fires when a preference is changed, and drag and
drop is not a workbook-level preference, it's an application-level
preference, so you can't really prevent a user from setting it manually
(you *can* remove the Tools/Options or Preferences menu item - they're
in different locations in WinWord and MacWord versions - remove keyboard
shortcuts, prevent access to the VBE, but it's hard if not impossible to
be completely comprehensive).

You could make a Workbook_SheetSelectionChange() macro that sets drag
and drop to false, but that won't prevent the user selecting a cell or
cells, changing the preference, and dragging and dropping *that*
selection.



In article ,
"Alan" wrote:

I have a workbook where we have disabled "Allow cell drag and drop".

I would like to be able to stop users from re-enabling it manually
from the Tools - Options menu.

Is that possible?


I know I can disable it using VBA by the following line:

Application.CellDragAndDrop = False


My problem is that I don't know when it has been changed manually by a
user?

I guess I actually either one of:

1) Stop it happening by disabling it entirely so users cannot
re-enable OR

2) Catch the re-enabling 'event' and trigger code that re-disables it
immediately.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default Identify when a user attempts to turn on "Allow cell drag and drop"

"JE McGimpsey" wrote in message
...

The only way I an think of is to use OnTIme macros to disable the
preference every so often.

There's no event that fires when a preference is changed, and drag
and drop is not a workbook-level preference, it's an
application-level preference, so you can't really prevent a user
from setting it manually (you *can* remove the Tools/Options or
Preferences menu item - they're in different locations in WinWord
and MacWord versions - remove keyboard shortcuts, prevent access to
the VBE, but it's hard if not impossible to be completely
comprehensive).

You could make a Workbook_SheetSelectionChange() macro that sets
drag and drop to false, but that won't prevent the user selecting a
cell or cells, changing the preference, and dragging and dropping
*that* selection.


Hi,

After posting I had an idea that perhaps by using:

Private WithEvents App as Application

in a class module might offer a way to find an event.

However, nothing is listed under there.

I had consdered using OnTime to do it periodically, but in order to
catch someone between turning it on and using it, I would have to fire
it every 5econds or so!

Do you think the WithEvents route has any legs?

Thanks,

Alan.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Identify when a user attempts to turn on "Allow cell drag and drop"

No. You can only use the Application defined events.

In article ,
"Alan" wrote:

Do you think the WithEvents route has any legs?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Identify when a user attempts to turn on "Allow cell drag and drop"

Perhaps if you explained *why* you needed to disable drag and drop
someone might have an idea or two. What's the difference for you between
d&d and cut/paste?


In article ,
"Alan" wrote:

I had consdered using OnTime to do it periodically, but in order to
catch someone between turning it on and using it, I would have to fire
it every 5econds or so!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default Identify when a user attempts to turn on "Allow cell drag and drop"

"JE McGimpsey" wrote in message
...

Perhaps if you explained *why* you needed to disable drag and drop
someone might have an idea or two. What's the difference for you
between d&d and cut/paste?


Hi,

The workbook is used to track workflow in a services business.

Client name, some other client details relating to the type of job,
date in, date started etc etc through to completion.

Users often filter the list to only show their clients, but we were
getting problems where a user 'dragged' or 'copied' a date (say) from
one row down through what appears to them as being only their clients,
but in fact also contains hidden rows with other clients, thus
creating a data integrity issue.

We disabled D&D and C&P to stop that happening.

Of course, we could just say it is a user training issue, but if
someone forgets just once, and saves the file, then everything can go
to pieces quickly. If they do it accidentally and know that, then
they
just don't save those changes.

The risk was such that we decided it would be best to disable that
functionality.

However, some bright sparks have been turning it back on. That is
okay, and they say 'we know what we are doing', but one of them did
forget, caused some damage, and didn't know it. In fact, they won't
even notice of course - it is someone else's client workflow data that
is damaged.

If you need more background, just ask.

Thanks,

Alan.







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Identify when a user attempts to turn on "Allow cell drag and drop"

Well, in part it's a training issue. But it's also a design issue. Since
I can't think of any way to make it foolproof (fools getting more clever
all the time), perhaps one way would be to protect the worksheet
(allowing filtering perhaps), and putting a button on the sheet that
removes that protection, disables drag and drop, and throws up a message
box saying something like "Drag and Drop has been disabled. in the
interest of data integrity, please don't change the Drag and Drop
preferences while editing this workbook". I'd use the
Workbook_SheetSelectionChange event to disable d&d every selection
change as well.

That way, someone would have to deliberately violate your restriction in
order to use d&d.



In article ,
"Alan" wrote:

The workbook is used to track workflow in a services business.

Client name, some other client details relating to the type of job,
date in, date started etc etc through to completion.

Users often filter the list to only show their clients, but we were
getting problems where a user 'dragged' or 'copied' a date (say) from
one row down through what appears to them as being only their clients,
but in fact also contains hidden rows with other clients, thus
creating a data integrity issue.

We disabled D&D and C&P to stop that happening.

Of course, we could just say it is a user training issue, but if
someone forgets just once, and saves the file, then everything can go
to pieces quickly. If they do it accidentally and know that, then
they
just don't save those changes.

The risk was such that we decided it would be best to disable that
functionality.

However, some bright sparks have been turning it back on. That is
okay, and they say 'we know what we are doing', but one of them did
forget, caused some damage, and didn't know it. In fact, they won't
even notice of course - it is someone else's client workflow data that
is damaged.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Identify when a user attempts to turn on "Allow cell drag and drop"

Alan,

You could try playing around with the following code.
Note what happens when a multi-cell selection is moved...
'---------------------------------------------------------
'Code goes in the worksheet code module.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CellDragAndDrop Then
Application.EnableEvents = False
Application.Undo
Application.CellDragAndDrop = False
Application.EnableEvents = True
End If
End Sub
'---------------------------------------------------------
Regards,
Jim Cone
San Francisco, CA

"Alan" wrote in message
...
Hi,
The workbook is used to track workflow in a services business.
Client name, some other client details relating to the type of job,
date in, date started etc etc through to completion.
Users often filter the list to only show their clients, but we were
getting problems where a user 'dragged' or 'copied' a date (say) from
one row down through what appears to them as being only their clients,
but in fact also contains hidden rows with other clients, thus
creating a data integrity issue.
We disabled D&D and C&P to stop that happening.
Of course, we could just say it is a user training issue, but if
someone forgets just once, and saves the file, then everything can go
to pieces quickly. If they do it accidentally and know that, then
they just don't save those changes.
The risk was such that we decided it would be best to disable that
functionality.
However, some bright sparks have been turning it back on. That is
okay, and they say 'we know what we are doing', but one of them did
forget, caused some damage, and didn't know it. In fact, they won't
even notice of course - it is someone else's client workflow data that
is damaged.
If you need more background, just ask.
Thanks,
Alan.


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default Identify when a user attempts to turn on "Allow cell drag and drop"

"JE McGimpsey" wrote in message
...

Well, in part it's a training issue. But it's also a design issue.
Since I can't think of any way to make it foolproof (fools getting
more clever all the time), perhaps one way would be to protect the
worksheet (allowing filtering perhaps), and putting a button on the
sheet that removes that protection, disables drag and drop, and
throws up a message box saying something like "Drag and Drop has

been
disabled. in the interest of data integrity, please don't change the
Drag and Drop preferences while editing this workbook". I'd use the
Workbook_SheetSelectionChange event to disable d&d every selection
change as well.

That way, someone would have to deliberately violate your

restriction
in order to use d&d.


I like that approach, and as you rightly point out, it makes
transgressions deliberate rather than accidental or just lazy.

I think I may also have to bite the bullet and use OnTime to reset the
settings every 5 seconds.

Thanks,

Alan.


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default Identify when a user attempts to turn on "Allow cell drag and drop"

"Jim Cone" wrote in message
...

Alan,

You could try playing around with the following code.
Note what happens when a multi-cell selection is moved...
'---------------------------------------------------------
'Code goes in the worksheet code module.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CellDragAndDrop Then
Application.EnableEvents = False
Application.Undo
Application.CellDragAndDrop = False
Application.EnableEvents = True
End If
End Sub
'---------------------------------------------------------
Regards,
Jim Cone
San Francisco, CA


Thanks Jim - I like that.

Alan.



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
Turn off "CALCULATE" on bottom of Excel worksheet. near "Ready" chrispal86 Excel Discussion (Misc queries) 2 February 2nd 10 08:36 PM
Shortcut to switch from "fill down" to "copy" with mouse drag RJ Dake Excel Discussion (Misc queries) 3 August 13th 09 05:35 PM
how can I disable "cutting cells" and "drag and drop "in excel ? mwoody Excel Worksheet Functions 4 August 25th 08 03:53 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
When I drag and drop overwrites my notes, Options ''Alert beforeoverwriting cell" lbbss Excel Discussion (Misc queries) 0 February 4th 08 02:11 AM


All times are GMT +1. The time now is 10:46 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"