Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Enable copying function

Dear experts,

I locate a code to disable the copy and paste function in web for one of my
workbooks in Excel. After adding the code to the workbook module, it not only
disabled the copy and paste function of that workbook, it disabled all other
workbooks as well (including new workbooks). The disable including icons on
standard toolbar and right click menu. The function under Edit menu is still
OK. Even I deleted the code from the window module, I still cannot enable the
copy and paste function back. Any solution I can enable back the copy and
paste function except only that workbook. Please help and advise how. I list
the code below for your reference.

Thanks a million.

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 268
Default Enable copying function

At the risk of been stupid, did you actually run your Sub EnableCutAndPaste()?

"Freshman" wrote:

Dear experts,

I locate a code to disable the copy and paste function in web for one of my
workbooks in Excel. After adding the code to the workbook module, it not only
disabled the copy and paste function of that workbook, it disabled all other
workbooks as well (including new workbooks). The disable including icons on
standard toolbar and right click menu. The function under Edit menu is still
OK. Even I deleted the code from the window module, I still cannot enable the
copy and paste function back. Any solution I can enable back the copy and
paste function except only that workbook. Please help and advise how. I list
the code below for your reference.

Thanks a million.

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Enable copying function

As the code is written by an Excel MVP stating the code function,
unfortunately, it did not state any risk of using it. Since I'm just a newbie
of VBA, how can I know the risk? I will not make any comments to your word
"stupid". Thanks anyway.

"kassie" wrote:

At the risk of been stupid, did you actually run your Sub EnableCutAndPaste()?

"Freshman" wrote:

Dear experts,

I locate a code to disable the copy and paste function in web for one of my
workbooks in Excel. After adding the code to the workbook module, it not only
disabled the copy and paste function of that workbook, it disabled all other
workbooks as well (including new workbooks). The disable including icons on
standard toolbar and right click menu. The function under Edit menu is still
OK. Even I deleted the code from the window module, I still cannot enable the
copy and paste function back. Any solution I can enable back the copy and
paste function except only that workbook. Please help and advise how. I list
the code below for your reference.

Thanks a million.

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 268
Default Enable copying function

Hey, I am not trying to insult you, I said I myself may be stupid for asking
this question. What I want to know is whether you actually ran the routine
to enable cut and paste again. The code example you gave, shows the routine,
but it does not show code that actually calls this routine. I ask again.
Have you actually tried to run this sub routine? If not, running it should
return functionality to what it was before.

In Excel, if you run a macro which changes normal behaviour, you have to run
a reverse operation, otherwise you sit with what you have now. In other
words, while running such a routine may appear not to have a global effect on
Excel, it actually does! Only by running the reverse routine, before exiting
the affected file, will it return functionality to normal for other workbooks.

Being a newbie is no disgrace! It actually displays courage to tackle the
unknown, my friend. It also lets one step into traps like this, and without
assistance you will not get out of the trap. Can we try again? Awfully
sorry if I offended you. It was definitely not the intention.

"Freshman" wrote:

As the code is written by an Excel MVP stating the code function,
unfortunately, it did not state any risk of using it. Since I'm just a newbie
of VBA, how can I know the risk? I will not make any comments to your word
"stupid". Thanks anyway.

"kassie" wrote:

At the risk of been stupid, did you actually run your Sub EnableCutAndPaste()?

"Freshman" wrote:

Dear experts,

I locate a code to disable the copy and paste function in web for one of my
workbooks in Excel. After adding the code to the workbook module, it not only
disabled the copy and paste function of that workbook, it disabled all other
workbooks as well (including new workbooks). The disable including icons on
standard toolbar and right click menu. The function under Edit menu is still
OK. Even I deleted the code from the window module, I still cannot enable the
copy and paste function back. Any solution I can enable back the copy and
paste function except only that workbook. Please help and advise how. I list
the code below for your reference.

Thanks a million.

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 158
Default Enable copying function

Dear Kassie,

Totally understood. Thanks for your reminding to ask me to run the "Enable"
code. The copy and paste functions are now restored. Actually, I'm too stupid
to overlook this step. Thanks for your time and kindness. Cheers.

Freshman

"kassie" wrote:

Hey, I am not trying to insult you, I said I myself may be stupid for asking
this question. What I want to know is whether you actually ran the routine
to enable cut and paste again. The code example you gave, shows the routine,
but it does not show code that actually calls this routine. I ask again.
Have you actually tried to run this sub routine? If not, running it should
return functionality to what it was before.

In Excel, if you run a macro which changes normal behaviour, you have to run
a reverse operation, otherwise you sit with what you have now. In other
words, while running such a routine may appear not to have a global effect on
Excel, it actually does! Only by running the reverse routine, before exiting
the affected file, will it return functionality to normal for other workbooks.

Being a newbie is no disgrace! It actually displays courage to tackle the
unknown, my friend. It also lets one step into traps like this, and without
assistance you will not get out of the trap. Can we try again? Awfully
sorry if I offended you. It was definitely not the intention.

"Freshman" wrote:

As the code is written by an Excel MVP stating the code function,
unfortunately, it did not state any risk of using it. Since I'm just a newbie
of VBA, how can I know the risk? I will not make any comments to your word
"stupid". Thanks anyway.

"kassie" wrote:

At the risk of been stupid, did you actually run your Sub EnableCutAndPaste()?

"Freshman" wrote:

Dear experts,

I locate a code to disable the copy and paste function in web for one of my
workbooks in Excel. After adding the code to the workbook module, it not only
disabled the copy and paste function of that workbook, it disabled all other
workbooks as well (including new workbooks). The disable including icons on
standard toolbar and right click menu. The function under Edit menu is still
OK. Even I deleted the code from the window module, I still cannot enable the
copy and paste function back. Any solution I can enable back the copy and
paste function except only that workbook. Please help and advise how. I list
the code below for your reference.

Thanks a million.

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 268
Default Enable copying function

Hi Freshman,

Glad I could help! Again, sorry for offending you

"Freshman" wrote:

Dear Kassie,

Totally understood. Thanks for your reminding to ask me to run the "Enable"
code. The copy and paste functions are now restored. Actually, I'm too stupid
to overlook this step. Thanks for your time and kindness. Cheers.

Freshman

"kassie" wrote:

Hey, I am not trying to insult you, I said I myself may be stupid for asking
this question. What I want to know is whether you actually ran the routine
to enable cut and paste again. The code example you gave, shows the routine,
but it does not show code that actually calls this routine. I ask again.
Have you actually tried to run this sub routine? If not, running it should
return functionality to what it was before.

In Excel, if you run a macro which changes normal behaviour, you have to run
a reverse operation, otherwise you sit with what you have now. In other
words, while running such a routine may appear not to have a global effect on
Excel, it actually does! Only by running the reverse routine, before exiting
the affected file, will it return functionality to normal for other workbooks.

Being a newbie is no disgrace! It actually displays courage to tackle the
unknown, my friend. It also lets one step into traps like this, and without
assistance you will not get out of the trap. Can we try again? Awfully
sorry if I offended you. It was definitely not the intention.

"Freshman" wrote:

As the code is written by an Excel MVP stating the code function,
unfortunately, it did not state any risk of using it. Since I'm just a newbie
of VBA, how can I know the risk? I will not make any comments to your word
"stupid". Thanks anyway.

"kassie" wrote:

At the risk of been stupid, did you actually run your Sub EnableCutAndPaste()?

"Freshman" wrote:

Dear experts,

I locate a code to disable the copy and paste function in web for one of my
workbooks in Excel. After adding the code to the workbook module, it not only
disabled the copy and paste function of that workbook, it disabled all other
workbooks as well (including new workbooks). The disable including icons on
standard toolbar and right click menu. The function under Edit menu is still
OK. Even I deleted the code from the window module, I still cannot enable the
copy and paste function back. Any solution I can enable back the copy and
paste function except only that workbook. Please help and advise how. I list
the code below for your reference.

Thanks a million.

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
EnableControl 19, False ' copy
EnableControl 22, False ' paste
EnableControl 755, False ' pastespecial
Application.OnKey "^c", ""
Application.OnKey "^v", ""
Application.OnKey "+{DEL}", ""
Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub

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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Need some comments on my Utility_Move class module. jchen Excel Worksheet Functions 0 August 21st 06 07:05 PM
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
copying existing function Brad Excel Worksheet Functions 0 February 22nd 05 01:34 PM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


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