Another Parse ? (1 Viewer)

kybb1

Registered User.
Local time
Today, 12:03
Joined
Dec 17, 2002
Messages
29
Good Morning,

Ok..so I'm a dummy...I know several ways of extracting from seperated strings..but I can't figure out how to separate the following:

frmBLABLA....I want to remove the "frm"

I know I can use "Left(txtFormName, 3)" but that only returns the value...not eliminate "frm". If the remaining part of the string would always be a constant value I could use the Right function, but it's not. What I'm trying to do is replace "frm" with "rpt" and keep the other part of the string.


Does anyone have any suggestions?

Thanks.
 

Mile-O

Back once again...
Local time
Today, 12:03
Joined
Dec 10, 2002
Messages
11,316
strName = "rpt" & Mid(strForm, 4)
 

kybb1

Registered User.
Local time
Today, 12:03
Joined
Dec 17, 2002
Messages
29
THANK YOU .... THANK YOU.....

Just so I understand ... (otherwise how would I learn), could you explain it to me?

Please?

Thanks a million.
 

kybb1

Registered User.
Local time
Today, 12:03
Joined
Dec 17, 2002
Messages
29
Never mind...I think I got it...it starts at mid point, position 4, replaces whatever was before that with "rpt" and maintains the rest...am I right?

Thanks
 

Mile-O

Back once again...
Local time
Today, 12:03
Joined
Dec 10, 2002
Messages
11,316
Mid() - begins in the middle of a string.
It has three arguments, two required, one optional.

The arguments are, in order.

String - the string you wish to get a value from
Position - at which character in the string to begin from
Length - the number of characters to extract from the string.


If the Length argument is omitted then VBA assumes you intend to extract from the start point (Position) to th end of the string.


So:

Mid(String, Position, Length)
 

Mile-O

Back once again...
Local time
Today, 12:03
Joined
Dec 10, 2002
Messages
11,316
Another way to learn more is, to select the command in the Code Module, and hit F1. You'll get the explanation and can then navigate around related functions, examples, etc.
 

Users who are viewing this thread

Top Bottom