Ok so situation is that, i have a CSV export written based of numerous text boxes. Due to CSV's being broken by characters such as "" and it being imperative that the outputted data is correct I need to ensure that special characters are not allowed.
The is relatively simple to do by adding the following code:
However, because i need this code to run on all textboxes it would be idea to include this code in its own function within the module.
However, regardless of whether this code is within a public function, public sub, or private sub, i simply cannot call it using either:
or
Any help would be much appreciated. No doubt it is to do with the (keyAscii As integer), i am just a bit lost!
Thanks in advance!
The is relatively simple to do by adding the following code:
Code:
public function special_char(keyAscii As Integer)
Select Case keyAscii
Case 48 To 57 'integers
Case 40 To 41, 45 To 45, 32 To 32, 65 To 90, 97 To 122, 240 To 240 'letters, brackets, space and hyphen
Case vbKeyDecimal
Case vbKeyBack
Case Else
alert
keyAscii = 0
Exit Sub
End Select
End function
However, because i need this code to run on all textboxes it would be idea to include this code in its own function within the module.
However, regardless of whether this code is within a public function, public sub, or private sub, i simply cannot call it using either:
Code:
call special_char
or
Code:
special_char
Any help would be much appreciated. No doubt it is to do with the (keyAscii As integer), i am just a bit lost!
Thanks in advance!