+ Reply to Thread
Results 1 to 9 of 9

Remove chinese chars

  1. #1
    Registered User
    Join Date
    04-25-2020
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    6

    Remove chinese chars

    Hi,

    I have excel files which containing chinese characters. When i run code on these files i get an error while saving. Showing me that file "Some filename ?????" can not be found. It seems it converts chinese characters to question marks.
    I tried a regex as seen below to remove the chinese pattern or question marks with string - 9 characters because that would remove them always. ( i also tried [\u4E00-\u9FFF]) But i can not use the name as function because the name in the variable Fname with ???? is different from the actual file in my folder which has chinese characters, which i can not get in a variable. How do i get around this?. See my code below.

    Please Login or Register  to view this content.
    Last edited by Smrie; 04-27-2020 at 12:20 PM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Remove chinese chars

    I have excel files which containing chinese characters
    You mean
    which containing chinese characters in the file name
    is it ?
    Can you attach a short sample of these files
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Remove chinese chars

    Today in the code your are showing, you are deleting the 9 last characters on the right ( included extension ) .
    Is it what you want ?

  4. #4
    Registered User
    Join Date
    04-25-2020
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    6

    Re: Remove chinese chars

    Hi,

    Yeah this is what i need. The code from yesterday works i just to need to be able to rename the excel files.
    Names are like WB0068638LNV*CICU8610449*IV*PL笔记本电脑 & CICU8607569*PL.LV*显示器. I rather not share the excel files because it contains customer data. It is

    I think it is because these are unicode characters. These files where created on a system with different language settings And can not be read to a string in vba because it is ANSII. Ill try to use Filesystemobject. Hopefully someone can help me out with a solution if that does not work.

  5. #5
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Remove chinese chars

    Its difficult without files

    why not list all the files in the folder to a spreadsheet. There are numerous bits of vba code that do this google it

    Please Login or Register  to view this content.
    do these filenames contain ? or Chinese characters?
    can you open these files with the name provided by the spreadsheet?

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Remove chinese chars

    I rather not share the excel files because it contains customer data
    Just send a file with nothing inside but with the right name
    Show what you need finally:
    from WB0068638LNV*CICU8610449*IV*PL笔记本电脑 & CICU8607569*PL.LV*显示器
    what is the result you want ??

  7. #7
    Registered User
    Join Date
    04-25-2020
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    6

    Re: Remove chinese chars

    Hi, thank you all for taking the time to look at my problem.

    Please Login or Register  to view this content.
    This does not work. I get an error 455, which when i google it says filesearch is outdated. I can try to use filesystemobject. I'll try that out today.

    from WB0068638LNV*CICU8610449*IV*PL笔记本电脑 & CICU8607569*PL.LV*显示器
    what is the result you want ??
    CICU8610449*IV*PL
    CICU8607569*PL.LV

    But anything with non chinese characters is fine. I added 2 files as an example.

  8. #8
    Registered User
    Join Date
    04-25-2020
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    6

    Re: Remove chinese chars

    I tried a filesystemobject code:

    Please Login or Register  to view this content.
    This show the following result:
    • CICU8052440;*IV*PL?????.xls
    • CICU8052706*IV*PL?????.xls
    • CICU8054247*PL.LV*???.xls
    • CICU8054817IV*PL?????.xls
    • CICU8054843*IV*PL?????.xls
    • CICU8055270*PL.LV*???.xls
    • CICU8606705*PL.LV*???.xls

  9. #9
    Registered User
    Join Date
    04-25-2020
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    6

    Re: Remove chinese chars

    Thank you all for trying to help. I solved it. For those interested, ill post the code. I used the Like statement when renaming the file.

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Remove Text After Certain Amount Of Chars
    By StephenSmith in forum Excel General
    Replies: 8
    Last Post: 08-06-2019, 02:31 AM
  2. [SOLVED] Remove Chinese text from cells.
    By taffthefish in forum Office 365
    Replies: 4
    Last Post: 06-20-2018, 09:08 PM
  3. [SOLVED] Save old data on query refresh to 1st empty cell in next col (done). Remove last 4 chars.
    By MartinS13X in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-19-2015, 06:21 AM
  4. Remove certain chars
    By viks83 in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2015, 11:19 AM
  5. Remove Chars in Call Based on Condition
    By FallingDown in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2014, 06:20 AM
  6. Remove iNdex chars From Left
    By teodormircea in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-21-2009, 08:19 AM
  7. [SOLVED] remove blanks from a string of chars within a cell?
    By rayhollidge in forum Excel General
    Replies: 3
    Last Post: 01-07-2005, 11:08 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1