Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vba, how to zip file with special characters?

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

like image 245
user3392351 Avatar asked Jul 03 '14 13:07

user3392351


People also ask

What characters Cannot be used in a zip file?

Some characters are not permitted when compressing files. Therefore, make sure your file does not contain symbols like “@,” “£,” “♥,” “§,” and similar. Beware that files inside should not hold such symbols either, so you might have to rename a lot… which might be tiring.

How do I create a zip file in VBA?

Zip VBA Macro But just modify the input parameters in it, before hitting F5. In some cases, you might get Object or variable not defined error, if you have not followed the exact order of code or missed any line mentioned above. Once the code executes successfully, you will get a zip file.

How do I zip an Excel file in Office 365?

Press and hold (or right-click) the file or folder, select (or point to) Send to, and then select Compressed (zipped) folder. A new zipped folder with the same name is created in the same location.


1 Answers

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.

like image 70
david m lee Avatar answered Sep 27 '22 17:09

david m lee