return the first and last 10 characters in a string

tony.reynolds

Board Regular
Joined
Jul 8, 2010
Messages
97
I have a browse button and a small text box in a userform that users can select an excel file and the small text box displays the full path

is there a way i can show only the first and last 25 digits and just show "..." in the middle?

So the user can see the drive letter and then last portion of the string..

like

C:\Documents and Settin... ...uments\My Pictures\Test.jpg
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Why not just use GetOpenFileName instead of a UserForm?

But in answer to your question:

TextBox1=Left(Textbox1,25) & "......" & Right(Textbox1,25)
 
Upvote 0
Thanks thats exactly what i wanted

I have a userform that uses getopenfilname

I use a form because it is backup wizard i have created so users can backup from an existing data and the user selects the file to backup from and a new name so it can save as 9keeps the original) ETC
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top