Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
splitting filename with VBA?
if you're sure that users have excel2000 or newer
you can use split function from vba have a look at split in vba help it will return a zero based variant Sub test() Dim parts As Variant Dim filename As String Dim i As Integer filename = "P_Contract232_20030531.pdf" parts = Split(Left(filename, Len(filename) - 4), "_") For i = 0 To UBound(parts) Cells(1, i + 1) = parts(i) Next End Sub keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool out_airborne wrote: Hi everyone, I am trying to create a status list of documents in a directory. I want to take as much workload away from my fellow collegues. So I thought it must be possible to get the information about a file directly from the filename itself. I am experienced in PHP, but don't know that much yet about VBA. I am happy for any help. Here the case again: Excel file columns: Filefilter (P for public, M for management, X1 for client x1) Filename (Contract232) Valid until (20030531) Now I thought, I could train the guys (and women) here to name a file for example: P_Contract232_20030531.pdf Then use Excel to check if the file is there (This I could do) and splitt the filename to the above mentioned parts... Hmm,... I checked the Internet for hours before I submitted this... so if any help is out there, I highly appreciate it!!! Yours, Oliver. [out_airborne] ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
splitting name | Excel Discussion (Misc queries) | |||
Splitting | New Users to Excel | |||
splitting Last Name, First Name | Excel Discussion (Misc queries) | |||
Cell("filename") doesn't update to new filename when do save as. | Excel Worksheet Functions | |||
set filename to <filename-date on open | Excel Worksheet Functions |