Vba to save and open excel file as UTF - 8

Anaya Zeeshan

New Member
Joined
Nov 4, 2021
Messages
33
Office Version
  1. 365
Platform
  1. Windows
I have a project in which I need to save file as utf - 8 and I am having 2 issues:
1) I can not figure out a code to save the file as UTF 8
2) and when I manually save it as UTF 8 and when I open that file in excel, it shows the same text in same format and not in converted version. The file opens fine in notepad though.
Thanks in advance:)
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
1. See here: How to manually save a CSV file with UTF-8 encoding — Workstars 0.0.1 documentation

2. That is because when Excel open CSV files, it automatically does its own conversions on the data. So what you are seeing may not truly be what actually is contained in the file.
For this reason, you should NEVER use Excel to view a CSV file, if you wish to see what the data actually looks like. You need to use a text editor, like NotePad.
If it looks correct in NotePad, then it is good.
 
Upvote 0
1. See here: How to manually save a CSV file with UTF-8 encoding — Workstars 0.0.1 documentation

2. That is because when Excel open CSV files, it automatically does its own conversions on the data. So what you are seeing may not truly be what actually is contained in the file.
For this reason, you should NEVER use Excel to view a CSV file, if you wish to see what the data actually looks like. You need to use a text editor, like NotePad.
If it looks correct in NotePad, then it is good.
Thank you for your reply.
Is there any way to automatically save it as utf - 8 using a vba code?
 
Upvote 0
Yes, you can use the SaveAs as choose the right file type.
If you turn on your Macro Recorder, and record yourself manually saving the file with the correct file type, you will see what the code needs to look like.
 
Upvote 0
Thanks alot. One last question, is there anyway to convert excel data to utf-8 standard without saving it as csv?
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top