hello,
hit a snag which im sure can be resolved easily enough but i cant seem to work it out.
basicaly im pasting contents of en email into a txt box and want to extract certain info into txt boxs, sort of like an autocomplete,
i dont want to read the emails directly before anybody suggests that as the people who use this db get the emails via different methods,
luckily even tho im not the worlds greatest coder the email is set out ina way that makes it quite easy for me to get most of the info, even with my limited coding knowledge, the one im having a prob with is the web address, as when its pasted in the txt box as its on a different line so it loses its spaces, and i cant use the instr fucntion to find the - after the address, as i keep getting the error, invalid call, procedure or argument
id also like to know if theirs a more effiecient or prof way of achieving what im trying to do. a copy of the emails is pasted below my code and is always the same format
any help as usual much appreciated
Private Sub cmdAuto_Click()
Dim sBody As String
Dim sp As String
Dim ep As String
Dim sExtract As String
'get body
sBody = Me.txtBody
'get opponent name
sp = (InStr(1, sBody, "v")) + 1
ep = InStr(1, sBody, "has")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtOpp = sExtract
'get date
sp = (InStr(1, sBody, "Date:")) + 5
ep = InStr(1, sBody, "Time:")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtDate = sExtract
'get map
sp = (InStr(1, sBody, "Map:")) + 4
ep = InStr(1, sBody, "Server:")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtmap = sExtract
'get Server
sp = (InStr(1, sBody, "Server:")) + 7
ep = InStr(1, sBody, "Password:")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtserver = sExtract
'get webaddress <------------------------- problem bit
sp = (InStr(1, sBody, "http:")) - 1
ep = InStr(1, sBody, "-")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtleague = sExtract
End Sub
#############
copy of email below
#############
************************************
ENEMY DOWN - MATCH ACCEPTED
************************************
The match between snipers v Syn^
has been accepted by the_ravendalian
Date: Sep 3rd 2009
Time: 20:00
Map: de_nuke
Server: 213.108.31.79:27020
Password: blahblah
Rules: PCW,MR15,5v5,XAC Mandatory,
------------------------------------------------
http://www.enemydown.co.uk/fixture.php?id=701675
------------------------------------------------
hit a snag which im sure can be resolved easily enough but i cant seem to work it out.
basicaly im pasting contents of en email into a txt box and want to extract certain info into txt boxs, sort of like an autocomplete,
i dont want to read the emails directly before anybody suggests that as the people who use this db get the emails via different methods,
luckily even tho im not the worlds greatest coder the email is set out ina way that makes it quite easy for me to get most of the info, even with my limited coding knowledge, the one im having a prob with is the web address, as when its pasted in the txt box as its on a different line so it loses its spaces, and i cant use the instr fucntion to find the - after the address, as i keep getting the error, invalid call, procedure or argument
id also like to know if theirs a more effiecient or prof way of achieving what im trying to do. a copy of the emails is pasted below my code and is always the same format
any help as usual much appreciated
Private Sub cmdAuto_Click()
Dim sBody As String
Dim sp As String
Dim ep As String
Dim sExtract As String
'get body
sBody = Me.txtBody
'get opponent name
sp = (InStr(1, sBody, "v")) + 1
ep = InStr(1, sBody, "has")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtOpp = sExtract
'get date
sp = (InStr(1, sBody, "Date:")) + 5
ep = InStr(1, sBody, "Time:")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtDate = sExtract
'get map
sp = (InStr(1, sBody, "Map:")) + 4
ep = InStr(1, sBody, "Server:")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtmap = sExtract
'get Server
sp = (InStr(1, sBody, "Server:")) + 7
ep = InStr(1, sBody, "Password:")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtserver = sExtract
'get webaddress <------------------------- problem bit
sp = (InStr(1, sBody, "http:")) - 1
ep = InStr(1, sBody, "-")
ep = ep - sp
sExtract = Mid(sBody, sp, ep)
Me.txtleague = sExtract
End Sub
#############
copy of email below
#############
************************************
ENEMY DOWN - MATCH ACCEPTED
************************************
The match between snipers v Syn^
has been accepted by the_ravendalian
Date: Sep 3rd 2009
Time: 20:00
Map: de_nuke
Server: 213.108.31.79:27020
Password: blahblah
Rules: PCW,MR15,5v5,XAC Mandatory,
------------------------------------------------
http://www.enemydown.co.uk/fixture.php?id=701675
------------------------------------------------
Last edited: