SelwynChan / HelloWorld

My first Git Repository
0 stars 0 forks source link

Delimiter #19

Open SelwynChan opened 1 year ago

SelwynChan commented 1 year ago

To change the delimiter in Excel, you can create a registry key that sets the delimiter to ASCII 31 (Unit Separator). Here is a script to change the delimiter to ASCII 31, and another to change it back to a comma.

Change delimiter to ASCII 31:

Save the following content in a file named change_delimiter_to_ascii31.reg:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options]
"ListSeparator"=hex(7):1f,00,00,00

Change delimiter back to comma:

Save the following content in a file named change_delimiter_to_comma.reg:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options]
"ListSeparator"=hex(7):2c,00,00,00

Instructions:

  1. Save the content provided above in two separate files, change_delimiter_to_ascii31.reg and change_delimiter_to_comma.reg.
  2. Double-click on the change_delimiter_to_ascii31.reg file to change the delimiter to ASCII 31. You'll be prompted to confirm that you want to add the information to the registry. Click "Yes" to confirm.
  3. To change the delimiter back to a comma, double-click on the change_delimiter_to_comma.reg file and confirm the action as before.

Please note that the provided scripts assume that you are using Office 2016 (Excel version 16.0). If you are using a different version of Office, replace 16.0 in the registry path with your version number (e.g., 15.0 for Office 2013, 14.0 for Office 2010, etc.).

SelwynChan commented 1 year ago

You can change the list separator in Windows by modifying the registry. Here are two scripts for you: one to change the list separator to the ASCII 31 character, and another to change it back to a comma.

Script 1: Change list separator to ASCII 31 character

  1. Open Notepad and copy-paste the following content:
@echo off
setlocal enabledelayedexpansion
set "list_separator=^%"

reg add "HKCU\Control Panel\International" /v "sList" /t REG_SZ /d "!list_separator!" /f

echo List separator changed to ASCII 31 character.
pause
  1. Save the file as change_list_separator_to_ascii_31.bat. Make sure to choose "All Files" in the "Save as type" dropdown.

  2. Double-click the saved .bat file to run it and change the list separator to the ASCII 31 character.

Script 2: Change list separator back to a comma

  1. Open Notepad and copy-paste the following content:
@echo off

reg add "HKCU\Control Panel\International" /v "sList" /t REG_SZ /d "," /f

echo List separator changed back to a comma.
pause
  1. Save the file as change_list_separator_to_comma.bat. Make sure to choose "All Files" in the "Save as type" dropdown.

  2. Double-click the saved .bat file to run it and change the list separator back to a comma.

Please note that these scripts modify the Windows registry. It's a good idea to create a backup of your registry before making any changes. Also, you might need to restart your computer or log off and back in for the changes to take effect.