Thread: regEx replace
View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default regEx replace

"GS" wrote:


Function FormatPhoneNumber$(TextIn$)
' .......
End Function 'FormatPhoneNumber()

Function FilterString$(ByVal TextIn$, Optional IncludeChars$, _
' ........
End Function 'FilterString()


Hey Gary. Thanks again for this code. I knew you always
had an alternative to regular expressions.


Ugh! It only handles North American phone numbers. I can see a use,
though, for having a function that formats based on country!

<FWIW
I use Farpoint's Spread.ocx in VB6 projects to duplicate my Excel
projects as stand-alone Windows apps for users that don't/won't use MS
Office. This control requires using code to replicate many of the
built-in Excel features it doesn't have. This is one function I make
use of for customer/vendor lists or contact info lists. It obviates
using a separate field if an (optional) extension is used with my
default Phone1/Phone2 data fields. I also have a function to format
credit card numbers, but haven't had need to format social security
numbers (yet).

The 3 Excel features I replicate by code most often are Group/Ungroup,
DV lists (which use a 'Combobox cell type' in place of a regular cell),
and CF. There are 15 'cell types' in all, many of which have restricted
'data type' input by default as their respective 'data validation'
feature. Thus, using 'dependant dropdowns' is also entirely managed by
code.

I also have the option to use multi-column dropdowns and multiple
header rows/cols. The latter can be replicated in Excel by using
FreezePanes, but this doesn't permit using FreezePanes in the
non-header cell area. Events is the primary code vehicle for
implementation.

Group/Ungroup is a bit tricky in that a hidden helper column is needed
to 'map' the range extent of a group. The coding is rather simple,
though, and I have the option of using a 'picture' cell type to display
whatever expand/collapse symbols I choose to use. I normally don't use
symbols, but rather use event code for the cell containing the group
'label' text. For example, expense/income/bank ledger sheets group
transactions for a fiscal period by month. Clicking a month 'label'
toggles expand/collapse of row details. On the expense/income ledger
sheets, clicking a Detail label toggles expand/collapse of the month
distribution cols. I like that this technique saves the screen real
estate lost by displaying the group/outline symbols Excel uses.

Fortunately the Spread.ocx has all the common built-in formula
functions I need, but it also supports UDFs.

--
Garry

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