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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Len Question

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
when searching for files using a inputbox how can I use the Len command to take the length of the file name entered in the inputbox and add a .jpg extension to it?? all files searched will be .jpg format..since i am searching a file list box it shows the file extension..

thanks dvannoy@onyxes.com
 
Hi dvannoy,
assuming that the name of your search string variable is searchstr and the name of your inputbox is inputboxvalue then the following should work.
Code:
searchstr = Left(inputboxvalue, Len(inputboxvalue)) & ".jpg"
 
this is what i have...

strpath = InputBox$("Enter file name:")

do i set InputBox = Inputboxvalue??

thanks dvannoy@onyxes.com
 
Hi dvannoy,
No do the following
Code:
strpath = InputBox$("Enter file name:")
' check that something was entered and append .jpg
if Len(strpath) > 0 then
    strpath = Left(strpath, Len(strpath)) & ".jpg"
end if

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top