Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Function To Check Email


Hello. I would like to create a function that will check if there is mail stored on a POP3 server on the internet (not local machine). I would like to use the result with a Microsoft Agent Character, so I guess I would need a Sub (or a function) that will return a 1 or a 0. Also, I would like some kind of button that a user can click if there is new mail so that the email client opens. But first thing's first: the checkmail() function. Where do I start?

Keep in mind, I'm a complete VB newbie, I've been programming VB for two days. However, I have a little expirience with basic C++, and a heavy PHP and SQL background, so I understand programming concepts. It's the syntax that I have yet to get. My environment is Microsoft Visual Basic 6.0 (not .NET).

From what I'm seeing, VB is pretty easy. In two days, I pretty much got the hang of Agent Scripting.

Thanks a lot for your help.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Email Check
hey,
is there a way to check if an email exists?
like Check if
person@hotmail.com
is a true email?
thanks

Check Email
Hi guys.I want to make a program that will show me when a new email in my hotmail acount comes! how can i do this?

Check Email
I am going to get an email address from user, split it to 2 parts:
First part before @, second part aftrer @.

Code:
Dim aa() As String
Public Function VerifyEmail(Email As String) As Boolean
'Split the text to 2 parts
aa() = Split(EmailIn, "@")
'Check 1st Part
If BeforeString(aa(0)) = False Then MsgBox "Invalid email address.", vbExclamation: VerifyEmail = False: Exit Function
'Check 2nd Part
'Allow Letters, Numbers, Dash, Dot in the second part
If AfterString(aa(1)) = False Then MsgBox "Invalid email address.", vbExclamation: VerifyEmail = False: Exit Function
VerifyEmail = True
End Function

Private Function BeforeString(String1 As String) As Boolean
Dim A As Integer
Dim char As Integer
For A = 1 To Len(String1)
char = Asc(Mid(String1, A, 1))
Select Case char
'Allow Underline, Dash, Dot, Numbers and Alphabet
Case 95, 45, 46, 48 To 57, 65 To 90, 97 To 122
BeforeString = True
Case Else
BeforeString = False
End Select
Next A
End Function

Private Function AfterString(String2 As String) As Boolean
Dim A As Integer
Dim char As Integer
For A = 1 To Len(String2)
char = Asc(Mid(String2, A, 1))
Select Case char
'Allow Dash, Dot, Numbers and Alphabet
Case 45, 46, 48 To 57, 65 To 90, 97 To 122
AfterString = True
Case Else
AfterString = False
End Select
Next A
End Function
For example, an email address like lo-ve@yah_oo.com is invalid, but the code does not work correctly !
help me plz

Can I Check Email
Can I Check Hotmail/Yahoo/Gmail/ any other free email accounts with out the help of outlook in VB?

Check Email
Does anyone know how to check new mails in vb without using outlook express?
i already searched planetsource code and they are too complex... i just wanna get a message like "you have 1 email"
nothing else... very simple...


Thanks.

Retrieve And Check Email With VB6
Hello,

I am looking for a way to retrieve email from a POP3 server and then check the senders address to see if it's on my allowed list before allowing it through to my email client. I have tried a few tests with the winsock control but don't seem to be having much luck, does anyone know how I can listen for mail coming in or would I be better to collect the mail myself, check the sender somehow and then pass it on to my email client?

Thanks

How Can I Check My Email In My Directly
How can I check my email (hotmail) directly (with out password) in my project

elaventhan

Can I Check POP(SSL Support) Email
Can I create a project that can send email from POP(SSL Support) Email account.
If You Explain about SSL this can be use full to me

Winsock - Check Email?
Hi All

I would like to access a mailbox on a POP server and check messages on the server. I would like to be able to select certain messages to be downloaded and disregard others.

Any1??

Check For Email/Net Connection?
Does anybody out there know how I would check to see if a system has an internet connection set up (I don't mean currently connected)?

Also is there a way of determining whether a machine has e-mail set up?

Email -Check Names?
Hi,
Can someone help me?
I'm trying to email out a report (HTM file) using vb. i've created an instance of Outlook to do this. However when I put in the email addresses, I keep getting a Check Names dialog box, it can't find the names. I click Cancel, wait a few seconds and suddenly the names are found and I can email (click Send). Any ideas? Obviously I don't want this box to appear everytime, and I don't know why it does - the email address are all valid addresses.

Any ideas??

sean.mullan@bt.com

How To Check If The Email Has Been Sent Out Using MAPI Control?
Does anyone know how to check if the email has been sent out using MAPI control? The original code shows as below:

MAPISession1.LogonUI = False
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1
MAPIMessages1.Compose
MAPIMessages1.MsgSubject = "Sending email!"
MAPIMessages1.MsgNoteText = strInfo 'message
MAPIMessages1.RecipIndex = 0
MAPIMessages1.RecipType = 1 'To ...
MAPIMessages1.RecipDisplayName = "Cannon Jay"
MAPIMessages1.RecipAddress = "cjia@uark.edu"
MAPIMessages1.Send False 'Without user interaction
' The followings do not work at all?????????
If MAPIMessages1.MsgSent = True Then
sValidation = "1" ' Successfully Sended
Else
sValidation = "0"
End If
MAPISession1.SignOff

Another thing is that there is always an Outlook Express message shown "Would you like to send the message?" /Send/ /Do Not Send/. Is any way to disable this function automatically?

Thanks a lot!!!

Check Mail Then Notify Through Email....
hi,
i am dying to be able to do this:

i want to have a program run in the background (by the clock) and it will check my pop3 mail every minute, as soon as a email is recieved it plays a assigned wav sound.

now the kicker.......

as soon as the mail is recieved i want the program to email the sender(s) name and email address ONLY to a different email address (my cellphone) so i know that i had an email while i was gone, then i can check my email on my phone because i would already know that there is a email waiting.

this would be nice because my mobile email address is FREE to recieve on the phone and it is an instant alert. once i recieve the alert, and see who just sent me mail...i can then use my data service to go get the mail through the phone.

PLEASE someone help, this would be an amazing program not just for me, but everyone with textmessaging on their phones.

steve
sznavor23@yahoo.com

Email Proggy To Check If MS Exchange Is Up
Hi everyone, I asked this question a while ago and got no
response. So I assumed that nobody knew the answer or just
didnt care . Anyway I'll ask again, I have this project
that I'm working on that Emails people so naturally i need
to use the Outlook object. Anyway to get to the point, can
someone tell me if they know how to check if our Exchange
server is up? something like

retry:
if ExchangeServer is down
wait 10 seconds
goto retry
else
mailitem.send

end if

hopefully someone knows thanks guys

Pete

How To Check The Email Addresses Existence
Hi

How to check the existence of an eMail Address?
Is that a way to ping the mail id??
NOT THE VALIDATION OF THE EMAIL ADDRESS
Karthik

Is It Possibe To Check The Email Is Valid
hi all,


does Visual Basic has any function to check if when the email is being send out , a return boolean response is return back to indicate this email is a valid email, for example if the user valid email is yuyestar@yahoo.com , however there is a typo error in the email when the user type yiyestar@@yahoo.com.

any mechanism or dll to check for the response?


 

Check Smtp/pop3 Email In Realtime
hi guys
is there a way to link gmail account or to check arrived email in realtime and receive the emails. if there is already a sample available please point it to me.

thanks

Auto Check Email And Download Attachments
Hi, It's me again, I'm on a roll today.

I am investigating a new application for my company. We have files that get transmitted to use via an attachment to an email. Would it be possible to write a program that automatically checks for emails with attachments and if it finds one, it downloads that file to a specific location on the local machine?

God it would be sweet if there is!

Thanks guys and gals,
Josh Sommers

Check Code For Sending Email Throuhg Excel
I am using the following code to send emails through excel.

Code:
Dim o
Dim m

Set o = CreateObject("Outlook.Application")
Set m = o.CreateItem(0)

m.To = Email
m.Subject = Subj
m.Body = Msg
m.Attachments.Add attachment
m.Display (True)

Set m = Nothing
Set o = Nothing
Just wondering if anybody sees any problems with this code, concerning speed and so on. Functionally it's working fine!

Email Function !!!!!!!!!!!!
Ok i am only 14, so please dont make this too complicated. Ihave a program that prints, the data they enter into a text file. i want to know how to have that file automatically emailed to me. There has to be some kind of function right?? . So please help me.

Email Function
I can write objects that send autogenerated email in ASP/VBscript, but how would you write it for Visual Basic?

Valid EMail Address (Well Just A Quick Check To See If It Has Common Errors?)
Hmm,

Error:
I get a type missmatch with:


VB Code:
If Not (InStr(Me.txtFromEMail, "@", ".")) Then GoTo InvalidEMail:


and with :


VB Code:
If Not (InStr(Me.txtFromEMail.text, "@" )) OR NOT (InStr(Me.txtFromEMail.text".")) Then GoTo InvalidEMail:


It wont accept it as a valid email at all.

Any idea/

Seeking Program Which Can Check A Excel File For Email Syntax
Hello Gurus,

I m looking out for a program that will check a excel file and throw out email addresses which are entered like these formats

1) a@a..com
2) b@a.com.
3) a b@a.com
4) na
5) n/a

Or any other formats, any help given is really welcome

Thanks Gurus,
Joy

VBscript To Check Folder && Send Email If File Exists Along With Path
I need a script which scans through folders and send email if file exists in particular folder, can someone help please.

Many Thanks in advance

Want To Know How To Write Email And Fax Function ?
now i am in my project assignment but i donno how too write vb sourcecode to fax function and email functionin side text editor. I hope someone can help me! thankz!

Email Calling This Function Send_mail ?
Public Function send_mail(sendto As String, subject As String, _
text As String) As Boolean
'Add The MAPI Components and
'add a MAPI Session and MAPI mail control to your form

'e.c.t
more coding go's here i left this out i just need to call this function how ? how do i call
send_mail what is the passing parameter
to this function call
i tried Call send_mail did not work.


Thank You ahead of time

<P ID="edit"><FONT class="small"><EM>Edited by visualbasic700e on 07/24/01 07:10 PM.</EM></FONT></P>

Email Function Error - MAPI
The following code worked great on it's own in a small program, but I'm trying to incorporate it into a larger program where it is called a couple times and am now getting "variable not defined" at the
Set objSession = CreateObject("MAPI.session")
line. It highlights objSession.
Can anyone help me out?

Thanks in advance.


VB Code:
Sub sendGEmail(outFile As String, badPO As String)    Dim badMail As String    Dim bad As String     Set objSession = CreateObject("MAPI.session")    objSession.Logon "", "", False, False, 0    Set objNewMessage = objSession.Outbox.Messages.Add    Set objRecipient = objNewMessage.Recipients.Add    Set objRecipient2 = objNewMessage.Recipients.Add    Set objRecipient3 = objNewMessage.Recipients.Add         'read badPO file into variable    Open "c:path" & badPO For Input As #1    Do Until EOF(1)        Input #1, bad        badMail = badMail & vbCrLf & bad    Loop        'add attachment    Set objAttachment = objNewMessage.Attachments.Add    objAttachment.Position = 0    objAttachment.Source = "c:winntprofiles
hartdesktop" & outFile        'add TO: info    objRecipient.Type = CdoTo    objRecipient.Name = "yada@yada.com"    objRecipient.Resolve    objRecipient2.Type = CdoCc    objRecipient2.Name = "yada@yada.com"    objRecipient2.Resolve    objRecipient3.Type = CdoCc    objRecipient3.Name = "yada@yada.com"    objRecipient3.Resolve     'format time stamp    mailDate = Format(Now, "mm/dd/yyyy")        If badMail = "" Then        bad = "None"    Else        bad = badMail    End If        'add subject and message text    objNewMessage.Subject = "yada PO Files received " & mailDate    objNewMessage.Text = "Attached you will find the yada PO file received on " & mailDate & "." & vbCrLf & vbCrLf _                        & "---------------------------" & vbCrLf _                        & "The following items did not exist and were reset to 999999-99999:" & vbCrLf _                        & bad & vbCrLf _                        & "--------End Of File--------"    objNewMessage.Update        'Send away    objNewMessage.Send        MsgBox "Mail sent!", , "Send Message" 'just to see that it worked        'close up shop    Set objSession = Nothing    Set objAttachment = Nothing    Set objNewMessage = Nothing    Set objRecipient = Nothing    Close 1, 2End Sub

Need A Good Invalid Email Function
Does anyone know of a good vb function that will verifiy a valid email address? Thanks

Can Any One Improve This Email ID Checking Function
hi

  Now i am using this emial id checking function. can any will improve this function for valid emailID.

  this function will return true if the mail id is true else it will return false.

Code:

Public Function CheckMail(Email As String) As Boolean
Dim i, j, l As Integer
Dim ok As Boolean
ok = False
l = Len(Email)
    If l > 0 Then
        For i = 1 To l
            If Mid(Email, i, 1) = "@" Then
                j = i + 1
                For j = i + 1 To Len(Email)
                    If Mid(Email, j, 1) = "." Then
                        CheckMail = True
                        Exit Function
                    End If
                Next
            End If
        Next
        CheckMail = False
    Else
        CheckMail = True
    End If
End Function





or else if any have a better function just post here.




thanks
---------------------------------------------
Srinivas.

SMTP Email Function Locking Up
I use the following email code in several app's, but in my latest, it is locking up every few runs. The file that is being attached is kind of large, but as I said, sometimes it is successful and sometimes it locks up. What am I missing?


Code:

'send the email
With SMTP
.Server = "ip address"
.Username = ""
.Password = ""
.MailFrom = "from"
.SendTo = "to" 'bill
.CC = "cc" 'chris
.BCC = "bcc" 'me
.MessageSubject = strSubject
.MessageText = strBody
.Attachments.Add (mailFile)
lblMain.Caption = lblMain.Caption & " Sending email..." & vbCrLf
Me.Refresh
.sendEmail
.Attachments.Remove (1) 'remove attachment so it doesnt mail again on second pass through
End With


Thanks in advance

VB6 SP5, by the way

Checkbox..... Check Check Check Check Check...oops Stack Error
I have three check boxes one on each of my SSTab tabs. If one is checked the other two needs to be unchecked.... and so on. I use this to determine which is the default website. Ok....here is the code I used....

Select Case Index
Case 0
chkDefaultWebsite(1).Value = vbUnchecked
chkDefaultWebsite(2).Value = vbUnchecked
' Case 1
chkDefaultWebsite(0).Value = vbUnchecked
chkDefaultWebsite(2).Value = vbUnchecked
Case 2
chkDefaultWebsite(0).Value = vbUnchecked
chkDefaultWebsite(1).Value = vbUnchecked
End Select

Simple enough right? Well the first time I click on the check box, my box isn't checked but my others are unchecked....so when I click again it checks it..... so I did this....

Select Case Index
Case 0
chkDefaultWebsite(0).Value = vbChecked
chkDefaultWebsite(1).Value = vbUnchecked
chkDefaultWebsite(2).Value = vbUnchecked
Case 1
chkDefaultWebsite(0).Value = vbUnchecked
chkDefaultWebsite(1).Value = vbChecked
chkDefaultWebsite(2).Value = vbUnchecked
Case 2
chkDefaultWebsite(0).Value = vbUnchecked
chkDefaultWebsite(1).Value = vbUnchecked
chkDefaultWebsite(2).Value = vbChecked
End Select

And of course I get a stack error of endless days err...I mean looping on the check box.....

How can I get that to check the first time I click on it and also uncheck the others ???

Thanks again !

Looking For A Function Similar To Printout For Email Attachments
Hello. Is there a function similar to printOut that will append email attachments onto an existing postscript file?

Thank you!

Getting IE Error When Trying To Use CDONTS Email Function && Inputbox
I am getting an error on the Internet Explorer status bar (little yellow ! followed by message "Error on Page") when i try click submit on this page. Here is the code:

<%@ Language=VBScript %>
<HTML>
<BODY>
<form name="Entry">
<table>

<tr>
<td>
<input class=butn type="submit" value="Submit" onclick="getEmail()" id="btnSubmit" name="btnSubmit"></input>
</td>

</tr>

</table>
<script language="VBscript">
'Start VBScript
Function getEmail()
Dim Inputemail
Dim objMail2

Inputemail = InputBox("Please Input your email")

Set objMail2 = Server.CreateObject("CDONTS.NewMail")

objMail2.From = "techsupport@arms.com"
objMail2.Subject = "A customer has signed up for an AOA class"
objMail2.To = Inputemail
objMail2.Body = "You have a new student signed up in the following AOA class:"

objMail2.Send
Set objMail = Nothing
End Function

</script>
</form>
</BODY>
</HTML>

What I am trying to do is get an email from someone who signs up for an online class by calling the email function when they click submit. It looks simple, but obviously i cant figure this one out...Please help!
Thanks for your time...
woohouz
Quote:




TALK IS CHEAP BECAUSE SUPPLY EXCEEDS DEMAND

Email Without Outlook (RESOLVED - New BASE64 Function!)
Does anyone know how to send an email without using MS outlook?

Any help would be appreciated

Cheers

Getting IE Error When Trying To Use CDONTS Email Function && Inputbox
I am getting an error on the Internet Explorer status bar (little yellow ! followed by message "Error on Page") when i try click submit on this page. Here is the code:

<%@ Language=VBScript %>
<HTML>
<BODY>
<form name="Entry">
<table>

    <tr>
        <td>
            <input class=butn type="submit" value="Submit" onclick="getEmail()" id="btnSubmit" name="btnSubmit"></input>
        </td>
        
    </tr>
    
</table>
<script language="VBscript">
'Start VBScript
Function getEmail()
Dim Inputemail
Dim objMail2

Inputemail = InputBox("Please Input your email")

Set objMail2 = Server.CreateObject("CDONTS.NewMail")
 
     objMail2.From = "techsupport@arms.com"
     objMail2.Subject = "A customer has signed up for an AOA class"
     objMail2.To = Inputemail
     objMail2.Body = "You have a new student signed up in the following AOA class:"

objMail2.Send
Set objMail = Nothing
End Function

</script>
</form>
</BODY>
</HTML>

What I am trying to do is get an email from someone who signs up for an online class by calling the email function when they click submit. It looks simple, but obviously i cant figure this one out...Please help!
Thanks for your time...
woohouz

Where Is An API Function To Create A New Email With Multiline In Body?
Hi all,
I'm trying to integrate sending email function in my application. So, I want to know how to create a new email like WinZip. I have tried to use ShellExecute API with lpFile parameter contains SUBJECT, CC, BCC and BODY values. It works well but the created email doesn't support multiline in BODY message. I have tried to put #13 and #10 to BODY string but there is always only one line text in BODY message.
Anyone know how to make an email with muiltiline in BODY message, please tell me.
Thanks in advanced,
Trung

Looking For A Function Similar To Printout For Email Attachments
Hello. Is there a function similar to printOut that will append email attachments onto an existing postscript file?

Thank you!

Check Function
I want to check if there is a valid ip

so it has to xxx.xxx.xxx.xxx and smaler.
so it can be xx.x.x.xx this one.

And i would like an input field with after 3 numbers.. that er wil come a point..
like
i = empty

iii.iii.iii.iii <-- that the . is automaticily in the input field

greetz

me

Check Data Function In Vb6
In my program, when the user enters data it all gets stored in 1 record and then saved to a file. But what I can't get it to do is that if a user enter's something that's already been saved into the file, then he/she will get a message box stating so.

I've got a module called booking, and here's the very poor code what I have so far, poor beacuse i've given up hope and left it.

Code:
Private Sub cmdCompareDayAndDate_Click()
Dim looping As Integer
Dim i As Integer
Open Filename For Random As #1 Len = Len(booking)
NumberOfRecords = LOF(1) / Len(booking)
Do While LOF(1)
For i = 1 To (Len(1))
Get #1, looping, booking
If booking.Day = booking Then
MsgBox "ERROR"
Else
MsgBox "NO ERROR"
End If
Loop



End Sub
I had more understandable code earlier until my mate decided to help me. The thing really is that I just can't compare it with the contents of the file, I was doing stuff like

Code:
if booking.day AND booking.date = commonDialog1.FileName then...
But yeah, that just compares it with the actual filename.

Any Function To Check Isalphanumeric?
Hi all,

There is a function "isnumeric". Is there any function to check if the string is alphanuermic?

Regards,
Cheung

Check If A Function Exists
Hi guys,

How do I check to see if a form has a function before I call it. Here's the problem:

In my project I have 10 forms but only 5 of them have a function called Validate(). In a function within a module I have a public function whick take in the forms as a parameter.

Public Function ProcessForm(frmForm as Form) As Boolean

Within the ProcessForm function I need to check to see if frmForm has function Validate. If so I will execute it:

blnResult = frmForm.Validate

If not I need to skip it.

Could someone please tell me how to do it?

Thanks a lot,
JDN

Check If This Function Has Bad Coding In It Please!
Is there something wrong with this function:

Code:
Function RetLine(Text As String, Line As Long) As String
Dim Lines As String
Lines = Split(Text, vbCrLf)
RetLine = Lines(Line)
End Function

If there is something wrong then please tell me! Is there a better way of implementing something like this!

How To Check A Function Exist?
I need to find out if a function exist before calling the function in VB.

I Need A Function That Sets Express To Be The Default Email Handler. Fn Attached
I have a function that returns the default Email handler. If the function returns something other than "Outlook Express" I want to have a function that sets the Default Email Handler to be "Outlook Express" The following is code that returns the default email handler:

Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const READ_CONTROL = &H20000
Private Const SYNCHRONIZE = &H100000
Private Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Private Const KEY_CREATE_LINK = &H20
Private Const KEY_CREATE_SUB_KEY = &H4
Private Const KEY_ENUMERATE_SUB_KEYS = &H8
Private Const KEY_NOTIFY = &H10
Private Const KEY_QUERY_VALUE = &H1
Private Const KEY_SET_VALUE = &H2
Private Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))

Public Function getDefaultEmailClient()
'Find the default Email Client in the
'registry.
Dim arrBuffer() As Byte
Dim lType, lSuccess As Long
Dim lKey, lLength As Long
Dim strSubKey, strKeyValue As String
Dim strValue As String
Dim Finish As Integer
Dim MyString As String
'Set the Key and Value that we want to
'retrieve.
strSubKey = "SoftwareClientsMail"
strKeyValue = ""

'Open the appropriate Key
lSuccess = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strSubKey, 0, KEY_READ, lKey)
'Get the length of the Key Value
lSuccess = RegQueryValueEx(lKey, strKeyValue, 0&, ByVal 0&, ByVal 0&, lLength)
'Initialize the buffer to lLength
ReDim arrBuffer(0 To lLength - 1) As Byte
'Get the Key Value
lSuccess = RegQueryValueEx(lKey, strKeyValue, 0, lType, arrBuffer(0), lLength)
'Initialize to lLength
strValue = String$(lLength, 0)
'Copy memory from the byte array to
'the string buffer.
CopyMemory ByVal strValue, arrBuffer(0), lLength - 1
'Close the open Key
RegCloseKey lKey
'Set the value of the function to the
'retrieved Key Value
Finish = Len(strValue) - 1
MyString = Mid(strValue, 1, Finish)
getDefaultEmailClient = MyString
End Function

How Do I Check A Network Path Using DIR Function
Hi,

I am using the DIR function to check if the path exists. I am reading the path from an INI file. If I specify the local system path (C:ProjectsMyDir)...then it returns MyDir which is expected. But when I specify a network Path (\ServerNameMyDir) then it gives me Error 52: Bad File Name.

What I did was share the file MyDir and then tried to access it? It was not working and was giving the error. But when I shared the parent folder i.e. Projects and gave the path (\ServerNameProjectsMyDir) it gave me the correct result. i.e MyDir.

I want to know why is this happening as we can access the same path from our windows (Start --> Run ). Is there some technical limitations to the DIR Function in such a case.

Pls help

Sandy

Textbox Validation Function - Check It Out
I have been noticing that a few persons have posted questions on how they can validate text box contains. I had to design a funcionfor a cusomer that would only allow the user to enter data in the following formats:

E05-09812A
WS0/3456SA

So I came up with the following function. This function allows the programmer the ability to control what type of alphanumeric character is entered into a text box at a particular postion in the text box.


VB Code:
Private Function ValidateKey(TextBoxName As TextBox, Keyascii As Integer) As IntegerDim strTagFilter As StringDim intPosition As Integer If Keyascii = 8 Then    Exit FunctionElse    If TextBoxName.Tag & "" = "" Then        Exit Function    Else        intPosition = Len(TextBoxName.Text) + 1 'Sets up the Tag pointer        strTagFilter = Mid(TextBoxName.Tag, intPosition, 1) 'Gets the Validator Code                If intPosition > Len(TextBoxName.Tag) Then 'Only allows the same number of characters                                          'that are contained in the Tag Property                        Keyascii = 0  'If so doesn't allow anymore characters        Else            TextBoxName.SelStart = intPosition 'Positions alphanumeric                                                'character after previous                                                'alphanumeric character            Select Case strTagFilter                Case "A", "a" 'Only allows Letters                    If (Keyascii >= 65 And Keyascii <= 90) Or _                            (Keyascii >= 97 And Keyascii <= 122) Then                                                    Keyascii = Keyascii                        If strTagFilter = "A" Then 'Capitalize the letter if "A"                           If (Keyascii >= 97 And Keyascii <= 122) Then                                Keyascii = Keyascii - 32 ' Capitalize the first charater                           End If                        End If                    Else                        Keyascii = 0 'invalid character                    End If                                    Case "0"    'Only allows numbers                    If (Keyascii < 48 Or Keyascii > 57) Then                        Keyascii = 0 'invalid character                    End If                Case Else                    If Keyascii <> Asc(strTagFilter) Then 'Only allows the same alphanumeric                                                          'Character (i.e. /-_=+&*()#$@!{}|)                       Keyascii = 0 'invalid character                    End If            End Select        End If    End IfEnd IfEnd Function


... and you call it like this ...

VB Code:
Private Sub Text1_KeyPress(Keyascii As Integer)    Call ValidateKey(Me.Text1, Keyascii)End Sub


So to allow the following number to be entered into a text box US35-39234B then enter th following into that textboxes Tag Property: AA00-00000A

Help?? Excel Check Function(i Am Stuck Here)
I use two different commands (cmd1,cmd2) to open an excel report file to sheet1 and sheet2, how can I check if the excel is open to activate the other sheet.

Cmd1--> sheet1
Cmd2-->sheet2

Private Sub cmd1_click()
Dim xlApp As Object
Dim xlWb As Object
Dim xlWs As Object

I need a check function here!!!!!!!!!!!!!
xlApp.Workbooks.Open (App.Path & "Report.xls")
Set xlWb = xlApp.Workbooks(1)
Set xlWs = xlWb.Worksheets("sheet1")
xlWb.Worksheets("sheet1").Activate
xlApp.Visible = True
xlApp.UserControl = True

end sub

How Do You Check Function Keys For MDI Forms
How can I check if a function key was pressed for a MDI form? I know for MDI Child forms you can check the Form_Keydown event.
Any ideas?

thanks,
Jeff

How To Check Whether An Optional Parameter To A Function Was Set
HI there,

I have a function in VB which has 2 optional parameters. How can I find out whether the parameter was set or not.

Regards,
Radhika

Copyright 2005-08 www.BigResource.com, All rights reserved