Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook VBA - how to get the substring

Status
Not open for further replies.

pho01

Programmer
Joined
Mar 17, 2003
Messages
218
Location
US
I'm using Outlook VBA to design custom form. One question that I have, how do I get a substring out of a string.
More specifically, I want to get an issue number out of the subject:

Here's the subject format:
Issue [issue_number for submission
Issue [234234] for submission

I want to get '234234' out of the subject string so I can submit the issue programatically.

Thanks,
 
Are the brackets actually in the field? If so, I would try something like the following:

leftbracket = instr(1,fieldname,"[")
rightbracket = instr(1,fieldname,"]")
issuelen = (rightbracket - 1) - (leftbracket +1) + 1
issuenumber = mid(fieldname,leftbracket + 1,issuelen)

Please change field names as appropriate. I have used the functions instr and mid quite a bit for this purpose.

HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top