[mso] Re: Excel Function to Access

  • From: "Glenda Wells" <gwells@xxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Fri, 4 Jun 2004 11:33:07 -0400

Thank you Jim.

The reason I asked is because I know zip...zero...nada...nothing about
VB or VBA.  I've picked up a few things from this list and searching the
web but that just means I'm a...monkey [see, monkey do]...no intelligent
lifeform here.=20

Your solution is definitely cleaner and more elegant. Just to point out
my lack of knowledge in this venue, I have nary a clue as to what this
means:  "Regular Expression ActiveX object" and no idea how to apply
your function.  Where for example, in Access would I place it and make
it run?

I only managed to get "mine" to work in Excel because I figured out how
add it in the VB editor...that is, I kept poking around until something
happened (...given infinite time, a thousand monkeys with typewriters
would eventually write the complete works of Shakespeare...)

/g

-----Original Message-----
From: Jim Pettit [mailto:j_e_pettit@xxxxxxxxxxx]
Sent: Friday, June 04, 2004 11:07 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Excel Function to Access

Glenda/All--

I brought your function into Access 2002, cleaned up the extraneous
characters, and tested it; it works fine. As it should; it's pure VBA,
and calls nothing that wouldn't be on any machine. Which is to say, it
should work for not just Access and Excel, but also Word, Project,
Visio, and any other application which uses VBA. Was your reason for
asking the question because it's *not* working in Access for you?

Anyway, just for kicks, here's the email validation function I use in
VBA; it makes use of the Regular Expression ActiveX object that's
present and available on any machine with IE 5.0 or newer:

Function IsEmailValid(sEmail) As Boolean
    Dim regEx As Object
    Dim retVal As Variant

    Set regEx =3D CreateObject("vbscript.regexp")
    regEx.Pattern =3D
"^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$"
    regEx.IgnoreCase =3D True
    retVal =3D regEx.Test(sEmail)
    If Not retVal Then
        IsEmailValid =3D False
    Else
        IsEmailValid =3D True
    End If
End Function

A little less verbose, wouldn't you say? Regular expressions are way too
cool...

--Jim




  _____ =20

<< ella for Spam Control >> has removed 10902 Spam messages and set
aside 0 Newsletters for me
You can use it too - and it's FREE!  www.ellaforspam.com=09
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: