vbProperCase not capping the first word

ajetrumpet

Banned
Local time
Today, 05:44
Joined
Jun 22, 2007
Messages
5,638
all,

i'm trying to rename my files, and the vbProperCase is not capitalizing the first word in the filename. is it not supposed to? I think it is supposed to, as it works on other folders where I use it. It works with strconv(), but when renaming files with the function, doesn't seem to pick up the first word like it should. here's the code:
PHP:
Function t()

On Error Resume Next

    Dim StopTime As Variant, start As Variant
    Dim ie As Object
    Dim address As String
    
    Dim fs, f, f1, fc, s, oFile, folderspec
    Dim oldname As String
    Dim newname As String
    folderspec = "C:\Users\ajetrumpet\Adam's Files\WebSite Files\"
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder(folderspec)
    Set fc = f.Files
    For Each f1 In fc

oldname = folderspec & f1.Name
newname = StrConv(folderspec & f1.Name, vbProperCase)
Name oldname As newname

    Next
         
    Set f = Nothing
    Set fc = Nothing
    Set fs = Nothing
    
End Function
need a little boost. thanks!
 
sorry folks, syntax error - the newname line should be:
PHP:
newname = folderspec & StrConv(f1.Name, vbProperCase)
but still, the files are not being renamed...

(the function works, as I printed the results through the loop, but the renaming does NOT)
 
What happens when you make the destination folder a different folder to the source folder? I'm guessing that windows thinks it is trying to copy the same file onto itself.
Chris
 
What happens when you make the destination folder a different folder to the source folder? I'm guessing that windows thinks it is trying to copy the same file onto itself.
Chris

I think you got it. when I change the dest. folder, the proper case is applied and the files ARE moved to the new dir. how strange...thank you for the breakthrough chris.


GET THIS too Chris...I tried a test from one folder to another instead of renaming inside the same folder, and afterwards, all 400 files in the folder i originally tried to change automatically changed to proper case. LAUGHING...
 
Last edited:

Users who are viewing this thread

Back
Top Bottom