Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
splitting name mtin Excel Discussion (Misc queries) 3 November 7th 08 07:00 PM
Splitting Tree*Rat New Users to Excel 3 October 21st 08 12:55 PM
splitting Last Name, First Name buggles Excel Discussion (Misc queries) 4 November 15th 07 01:07 AM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM


All times are GMT +1. The time now is 02:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"