Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Problems with MkDir

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Problems with MkDir

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Problems with MkDir

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Problems with MkDir

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
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
mkdir Peter[_61_] Excel Programming 2 May 12th 07 12:48 PM
MKDir not working Robert_L_Ross Excel Programming 3 June 30th 06 07:17 AM
mkdir problem Tom Ogilvy Excel Programming 2 August 31st 04 03:22 PM
mkdir problem Norman Jones Excel Programming 0 August 30th 04 04:37 PM
MkDir error Eric Excel Programming 3 May 17th 04 08:58 PM


All times are GMT +1. The time now is 12:58 AM.

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

About Us

"It's about Microsoft Excel"