Convert CSV Unicode Text type to CSV MS-DOS type

Enna

New Member
Joined
Oct 5, 2021
Messages
41
Office Version
  1. 2010
Platform
  1. Windows
I have multiple large CSV files. I would like to change the file type from Unicode text to MS-DOS without opening all the files. Is there a way to do that? Thank you
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I do not have an access via cmd.
Really? That's pretty unusual on a windows box. What happens if you run this bit of code?

VBA Code:
Sub ShellToCMD()
'Open command window
 Shell "cmd.exe", vbNormalFocus
End Sub
 
Upvote 0
Really? That's pretty unusual on a windows box. What happens if you run this bit of code?

VBA Code:
Sub ShellToCMD()
'Open command window
 Shell "cmd.exe", vbNormalFocus
End Sub[/CODE
[/QUOTE]

Really? That's pretty unusual on a windows box. What happens if you run this bit of code?

VBA Code:
Sub ShellToCMD()
'Open command window
 Shell "cmd.exe", vbNormalFocus
End Sub
Then it pops up the cmd window but not the onedrive cloud directory where are my csv files
 
Upvote 0
Then it pops up the cmd window but not the onedrive cloud directory where are my csv files
That is an easily solvable problem -> Use Windows explorer to Move or Copy the files you want to convert from the OneDrive folder to a temporary folder on your hard drive. Then try the recommendation I made back in post #8.

VBA Code:
Sub ShellToCMD()
   Dim LocalFolderPath As String
   'Open a command window
   
   LocalFolderPath = "C:\DOS\FileToConvert\" 'edit. Where the files are.

   ChDrive Left(LocalFolderPath, 1)
   ChDir LocalFolderPath
   
   VBA.Shell "cmd.exe", vbNormalFocus
End Sub
 
Upvote 0
What a batch file might look like

Code:
:: Windows CMD.EXE batch file
:: Process all .CSV files in the directory
@echo off
SETLOCAL EnableDelayedExpansion
del /Q dos*.csv
Date /T > ConversionLog.txt
Time /T >> ConversionLog.txt
SET count=1
for  %%x in (*.csv) DO (
echo %%x   to   DosFile%count%.csv >> ConversionLog.txt
echo %%x   to   DosFile%count%.csv
type %%x > DosFile%count%.csv
set /A count+=1
)
:: end batch file
 
Upvote 0
That is an easily solvable problem -> Use Windows explorer to Move or Copy the files you want to convert from the OneDrive folder to a temporary folder on your hard drive. Then try the recommendation I made back in post #8.

VBA Code:
Sub ShellToCMD()
   Dim LocalFolderPath As String
   'Open a command window
  
   LocalFolderPath = "C:\DOS\FileToConvert\" 'edit. Where the files are.

   ChDrive Left(LocalFolderPath, 1)
   ChDir LocalFolderPath
  
   VBA.Shell "cmd.exe", vbNormalFocus
End Sub
The files are too large to move around or open and close. So, I would like to change to the CSV MS-DOS without opening and moving. Is this possible? Thank you
 
Upvote 0
The files are too large to move around or open and close. So, I would like to change to the CSV MS-DOS without opening and moving. Is this possible? Thank you
It is not possible to do it without opening the file. You don't necessarily have to open the CSV file with Excel, but you have to open it with something (a text editor, a batch file, vba) to do the conversion.
 
Upvote 0
It is not possible to do it without opening the file. You don't necessarily have to open the CSV file with Excel, but you have to open it with something (a text editor, a batch file, vba) to do the conversion.
How can I use a vba code? I can open one of the files and run the vba code, but I don’t know how to write the vba code. Thank you
 
Upvote 0
How can I use a vba code? I can open one of the files and run the vba code, but I don’t know how to write the vba code. Thank you
If you don't know how to write VBA code, then I do not think that VBA is a viable solution for you unless someone volunteers to create the code for you. I wish you well, but unfortunately I do not have the time to spend on that effort.
 
Upvote 0

Forum statistics

Threads
1,215,438
Messages
6,124,875
Members
449,192
Latest member
MoonDancer

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