Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default disabling custom buttons during cell edit mode

Is there any way to disable custom buttons durning cell editing, as occurs
with builtin buttons? I found an old post from Tom Ogilvy suggesting to
copy a builtin button and then reassign the onaction, caption, etc.
However, it seems that assigning a new onaction loses the trait of graying
out during cell edit. Here's the code I tried:

Sub test()
Dim cbar As CommandBarPopup
Dim ctl As CommandBarControl

On Error Resume Next
CommandBars(1).Controls("test").Delete
On Error GoTo 0

Set cbar = CommandBars(1).Controls.Add(Type:=msoControlPopup,
temporary:=True)
cbar.Caption = "test"
Set ctl = cbar.Controls.Add(ID:=757) 'Edit -- Go To button
With ctl
.Caption = "tester"
.OnAction = "tester"
End With

End Sub

Sub tester()
MsgBox "test"
End Sub

Thanks,

Doug

--
Doug



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default disabling custom buttons during cell edit mode

First, your ADO Connection...

change

cn.Cstring

to

cn.open Cstring

or

with cn
.connectionstring=Cstring
.open
end with

HTH

Philip

"Doug Glancy" wrote:

Is there any way to disable custom buttons durning cell editing, as occurs
with builtin buttons? I found an old post from Tom Ogilvy suggesting to
copy a builtin button and then reassign the onaction, caption, etc.
However, it seems that assigning a new onaction loses the trait of graying
out during cell edit. Here's the code I tried:

Sub test()
Dim cbar As CommandBarPopup
Dim ctl As CommandBarControl

On Error Resume Next
CommandBars(1).Controls("test").Delete
On Error GoTo 0

Set cbar = CommandBars(1).Controls.Add(Type:=msoControlPopup,
temporary:=True)
cbar.Caption = "test"
Set ctl = cbar.Controls.Add(ID:=757) 'Edit -- Go To button
With ctl
.Caption = "tester"
.OnAction = "tester"
End With

End Sub

Sub tester()
MsgBox "test"
End Sub

Thanks,

Doug

--
Doug




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default disabling custom buttons during cell edit mode

Wow, I would have never thought of that! <g

Any other thoughts?
--
Doug


"Philip" wrote in message
...
First, your ADO Connection...

change

cn.Cstring

to

cn.open Cstring

or

with cn
.connectionstring=Cstring
.open
end with

HTH

Philip

"Doug Glancy" wrote:

Is there any way to disable custom buttons durning cell editing, as
occurs
with builtin buttons? I found an old post from Tom Ogilvy suggesting to
copy a builtin button and then reassign the onaction, caption, etc.
However, it seems that assigning a new onaction loses the trait of
graying
out during cell edit. Here's the code I tried:

Sub test()
Dim cbar As CommandBarPopup
Dim ctl As CommandBarControl

On Error Resume Next
CommandBars(1).Controls("test").Delete
On Error GoTo 0

Set cbar = CommandBars(1).Controls.Add(Type:=msoControlPopup,
temporary:=True)
cbar.Caption = "test"
Set ctl = cbar.Controls.Add(ID:=757) 'Edit -- Go To button
With ctl
.Caption = "tester"
.OnAction = "tester"
End With

End Sub

Sub tester()
MsgBox "test"
End Sub

Thanks,

Doug

--
Doug






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default disabling custom buttons during cell edit mode

sorry, I answered the wrong post :)

for your one, I reckon you need to retrieve a reference to the button on the
toolbar and use thre .enabled property=false

to do that while a cell is in edit-mode?

have a look at the worksheet events, like worksheet_change.

But I really don't know if that type of functionality will help as normally
to signal a cell is in edit mode, behind the scenes I think Excel raises and
traps the 'Onkey down' events or mouse double-click event.

But those events are not exposed to VBA, so you're looking at sub-classing -
which is maybe going to far... and is quite involved... you'd need to use the
AddressOf operator - declare a variable withevents as a worksheet object, set
it to the active sheet, then see if you can't get more events that way
perhaps.

Sorry I can't help more...

Philip

"Doug Glancy" wrote:

Wow, I would have never thought of that! <g

Any other thoughts?
--
Doug


"Philip" wrote in message
...
First, your ADO Connection...

change

cn.Cstring

to

cn.open Cstring

or

with cn
.connectionstring=Cstring
.open
end with

HTH

Philip

"Doug Glancy" wrote:

Is there any way to disable custom buttons durning cell editing, as
occurs
with builtin buttons? I found an old post from Tom Ogilvy suggesting to
copy a builtin button and then reassign the onaction, caption, etc.
However, it seems that assigning a new onaction loses the trait of
graying
out during cell edit. Here's the code I tried:

Sub test()
Dim cbar As CommandBarPopup
Dim ctl As CommandBarControl

On Error Resume Next
CommandBars(1).Controls("test").Delete
On Error GoTo 0

Set cbar = CommandBars(1).Controls.Add(Type:=msoControlPopup,
temporary:=True)
cbar.Caption = "test"
Set ctl = cbar.Controls.Add(ID:=757) 'Edit -- Go To button
With ctl
.Caption = "tester"
.OnAction = "tester"
End With

End Sub

Sub tester()
MsgBox "test"
End Sub

Thanks,

Doug

--
Doug







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
Is it possible to arrow to a different cell while in edit mode? Latka2k Excel Discussion (Misc queries) 1 December 9th 05 09:51 PM
VSTO and Excel--End Cell Edit Mode? Jim Tilson Excel Programming 15 September 29th 05 08:40 PM
VBA command for edit cell mode quartz[_2_] Excel Programming 2 April 15th 05 02:57 PM
cell value in edit mode with COM addin Julian Tucker Excel Programming 0 September 7th 04 11:51 AM
Detecting Cell Edit Mode Marc[_15_] Excel Programming 1 December 3rd 03 11:09 PM


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