LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Declare Function for global use then call on change event

Say i wanted to have a numbersonly function

I would Declare this in a new module, but when i call it

Function MyFunction(NewText as string)
On Error GoTo ErrorHandler
If IsNumeric(Chr(strTempAscii)) Or Chr(strTempAscii) = "-" Or _
Chr(strTempAscii) = "/" Or Chr(strTempAscii) = "\" Then

Else
strTempAscii = ""
TxtDtoAtto2.Text = Left(TxtDtoAtto2.Text, Len(TxtDtoAtto2.Text) -
1)
End If

ErrorHandler:
End Function


When i call it Like


Private Sub TxtDtoAtto2_Change()
MyFunction( TxtDtoAtto2)
End sub
Private Sub TxtDtoAtto2_KeyPress(ByVal KeyAscii As
MSForms.ReturnInteger)
strTempAscii = ""
strTempAscii = KeyAscii
End Sub

it doesnt work, Is there something im not doing?
 
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
How to declare global variable in Excel VBA? Sing Excel Programming 1 September 23rd 07 04:50 AM
call a function on control click event tkraju via OfficeKB.com Excel Discussion (Misc queries) 7 August 25th 06 07:22 AM
Global array declare Souris Excel Programming 3 August 20th 05 11:38 AM
Declare API call to Windows GetFile Andibevan[_2_] Excel Programming 6 July 1st 05 03:50 PM
Global event handler?? [email protected] Excel Programming 1 October 23rd 04 05:31 PM


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