View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Using TAB as CSV delimiter

GS wrote:

vbKey<X is useful for avoiding magic numbers. Writing your code
now, you know that 27 is Escape (or whatever), but a month from
now? A year? Unless you normally carry those values in your head,
it's best IMO to use the constants.


Yeah, you make a valid point! Yes, the ESC key # is 27 and since
it's the only one I use it's easy to remember. However, I do feel
that using the constant makes code more self-documenting and so I
should change my habits to that end.


I strongly recommend it -- but OTOH, in some of my old VB6 projects,
I used various keys in such a way that it was common to see
something like this:

Select Case KeyCode
Case vbKeyTab
Case vbKeyLeft
Case Asc("W")
End Select


I started using this line in the _Keypress event on forms...

If KeyAscii = 27 Then Unload Me 'Esc

...as the default in my form template, which was formatted for font and
had the basic Ok/Cancel buttons placed. I just did copy/paste to insert
the line in other _Keypress events.

As of now the form template has been modified as follows.

If KeyAscii = vbKeyEscape Then Unload Me

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion