Problems with MkDir

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I have encountered a problem that has me stumped in extending a project that
I am currently working on. The MkDir code line fails every time unless I hard
code the Folder name in (not an option for the release version).

MkDir stPath & stSName <- Error 76 Path not Found

Where stPath = "G:\HR\CV's\JobshopCV's\"
and stSName is returned with the following:

MyPos = InStr(1, rg, SearchChar) - 1
MyPos2 = InStr(1, rg, SearchChar2) + 8
myVar = Left(rg, MyPos)
myVar2 = Right(myVar, MyPos - MyPos2)
stSName = Trim(myVar2)

The only thing that I can think of as being wrong is with the stSname
return, as I have tested this by hardcoding the final desired file path
(which works) and hardcoding the separate variables (also works)

Would the fact that the stSName Var returns the following eg affect this?
Debug.Print stSName < -- Returns "REZA " << note the space

Somehow Trim(myVar2) does not remove this?

Any ideas?

Thanks in advance
 
You may have something other than a space as the last character that is not
being trimmed. Try adding msgbox(asc(right(stSName))) to see what the last
character.
 
Thanks Joel

I had a feeling that it was a carriage return or osme such non printing
Char, just had no idea on how to find it.

Must remember to engage brain first ;-)
 
Back
Top