8

When zipping all files in a folder i get an error

    '''''Create empty Zip File
    NewZip (FileNameZip)
    Set oApp = CreateObject("Shell.Application")
    '''''Copy the files to the compressed folder

    oApp.Namespace(FileNameZip).CopyHere oApp.Namespace(FolderName).items ''error here

Error: c:...\Jørgen.doc cannot be compressed because it includes characters that cannot be in a compressed folder, such as ø. You should rename this file or directory.

However if i navigate to the file and manually copy it to the zip folder it works no problem. Is there a way to get round this error in my vba code

user3392351
  • 135
  • 1
  • 7
  • Very interesting Q. +1. I guess it's more of a system level thing than something to do with VBA. But not 100% sure. Would be curious to see what the solution is. – hnk Jul 03 '14 at 13:31
  • What are you doing when you are Manually copying?like drag and drop into the zip file? – Ravi Yenugu Jul 03 '14 at 14:11
  • yes drag and drop or copy paste – user3392351 Jul 03 '14 at 14:39
  • 1
    @hnk - if it were a system problem then i would not be able to do it manually either no? – user3392351 Jul 03 '14 at 16:01
  • I mean, the system might not grant privileges to an application calling it the same way it grants a user operating the GUI. Again, just a guess. – hnk Jul 03 '14 at 16:03
  • @user3392351: Not strictly an answer, but I had so many issues fumbling around with the VBA zip file hacks that I switched to a shell call to 7zip. The VBA way is buggy and I've had lots of issues depending on what machine I was on. With 7zip, no problems. I've tried with your filename and it works. If you're interested here is where you can get the exe (http://www.7-zip.org/download.html) and here's some command line references (http://www.dotnetperls.com/7-zip-examples). It's a time investment to change your routines, but 7zip is MUCH stabler. – VBlades Jul 03 '14 at 21:40

2 Answers2

5

It's already a standard feature in MacOS, but in Windows 10 you need to to the following:

Type "region" in the Start Menu search box

  1. Open the Region and Language Control Panel

  2. Click the Administrative tab on the top

  3. In "Language for non-Unicode programes" section, click "Change system locale...".

  4. Check "Beta: Use Unicode UTF-8 for worldwise language support."

  5. Restart Windows and try again.

david m lee
  • 2,547
  • 26
  • 14
0

Use dotnetzip. It supports international (unicode) filenames.

See here in the answer to this SO question.

Community
  • 1
  • 1
pashute
  • 3,965
  • 3
  • 38
  • 65