LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Workaround for ChDir/CurDir when path has unicode characters

Hi guys, long time.

Problem:
VBA.Filesystem works with ansi paths, not with unicode paths.
e.g. CurDir/ChDir and several other methods return converted strings,
without the actual unicode characters.

For testing:
(English WindowsXP and Excel 97 thru 2007 (or actually VBA 6.5.1020))


Create a folder with a unicode character in the name: Arab?Test
where the ? is unicode x06E9, which looks nice in CharMap,
but any extended unicode character will do.

In that folder create a file with another "foreign" char.

Excel has no problems changing folders and opening/saving files.
However VBA is thoroughly confused.
When I've navigated to the "culprit" folder via excel's File/Open
dialog and i try following in VBE immediate:

ChDir CurDir

I get error 76 path not found!


I've done some research and experimenting:
created following workarounds:

With New Scripting.FileSystemObject
'Retrieve the full unicode string for CurDir.
szCurDir = .GetAbsolutePathName(Vba.CurDir$)
'Change to this folder using short 8.3 name.
vba.ChDir .GetShortPath(vba.CurDir$)
End With

I need a trick for ChDir without short (8.3) paths
(looks terrible AND can be turned of in NTFS)...

I dont mind a ton of apis but it must be foolproof.

--
keepITcool

 
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
Need to convert Characters between Unicode and ANSI FcoMariscal Excel Programming 0 August 24th 06 10:47 PM
Extra characters exported in unicode(.txt) format PT Excel Discussion (Misc queries) 0 February 7th 06 11:29 AM
inserting unicode characters Wazooli Excel Discussion (Misc queries) 1 February 7th 05 06:54 PM
How do I enter Unicode characters in Excel? MacroAlan[_4_] Excel Programming 0 February 5th 05 08:25 PM
chdir not accepting string for path Alan Excel Programming 1 October 13th 04 06:18 PM


All times are GMT +1. The time now is 02:51 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"