Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Cancel RefEdit

I have a refedit control on a form. Once the user activates the control I
would like to have an event that checks if a certain sheet is selected. If
false then I want to cancel the action so that the user doesn't get to select
a range and is returned to the form. Can this be done?

Any help is apriciated
The Doctor


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Cancel RefEdit

Hi Doc

The Refedit is buggy. Every time I put code into its events it crashes. So
you may try its Change event, but be prepared to consider other solutions,
like in the OK button click instead.

You evaluate it like this:

Dim R as Range
On Error Resume Next
Set R = Range(Refedit1.text)
On Error Goto 0
If R Is Nothing Then
Refedit1.SetFocus
Exit Sub
End If
If R.Parent.Name = "Sheet2" then
Refedit1.SetFocus
Exit Sub
End If
'and whatever exceptions you need here
'and further action here

HTH. Best wishes Harald

"Dr.Schwartz" skrev i melding
...
I have a refedit control on a form. Once the user activates the control I
would like to have an event that checks if a certain sheet is selected. If
false then I want to cancel the action so that the user doesn't get to

select
a range and is returned to the form. Can this be done?

Any help is apriciated
The Doctor




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
Workbook_BeforeClose(Cancel As Boolean) - Cancel won't work gpmichal Setting up and Configuration of Excel 1 May 12th 09 02:33 AM
Before print, cancel print and cancel copy/paste Claus[_3_] Excel Programming 5 August 26th 05 11:13 AM
Cancel Macro is user selects 'cancel' at save menu Mark Excel Programming 1 April 6th 05 05:45 PM
RefEdit in VB6 Ben Crinion Excel Programming 0 October 8th 04 11:00 AM
RefEdit daMike[_2_] Excel Programming 3 December 13th 03 07:31 PM


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