Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. "steve_doc" wrote: 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 ;-) "Joel" wrote: 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. "steve_doc" wrote: 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can remove it with this
stSName = left(stSName,len(stSName) - 1) "steve_doc" wrote: 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 ;-) "Joel" wrote: 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. "steve_doc" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
mkdir | Excel Programming | |||
MKDir not working | Excel Programming | |||
mkdir problem | Excel Programming | |||
mkdir problem | Excel Programming | |||
MkDir error | Excel Programming |