3 Attachment(s)
File types: Excel and Text
Quote:
Originally Posted by
fixer
….lets come to pasting of the data
since we know that 2.csv is a csv file, macro should paste the data clearly correctly , not incorrectly
correct way of pasting the data ..…and no notepad data….
I think this indicates a continued mis understanding. 2.csv is not a csv file. It is a text file. It is not an Excel File. It is not a csv file
The term "csv file" does not have a precise definition. It is a general term used very loosely in general discusions. Its use can be misleading.
Sometimes when we say csv file , we really mean to say that it is a text file, and it has comma separated values like
4,g,,tz,hk
- here the values that we want are
- 4 - g - - - - tz - hk -
and in the file, we include commas , to separate them. The comma separators are included to help us not make a mistake like
- 4g - tzh - k
File types: Excel and Text
If we see that 2.csv is a file like xxxxx.csv , then we know that it is a Text file, or text document….
.csv = Text file, not Excel File
2.csv is a text file. It cannot be an Excel file. Because there are no Excel xxxxx.csv files. Not anywhere in the Universe. God cannot make a xxxxx.csv Excel file. It is not possible to make an Excel xxxxx.csv
Excel Files .xls .xlsx .xlsm .xlsb
These are some of the file extensions indicating that we have Excel files: .xls .xlsx .xlsm .xlsb
These are usually opened and viewed in Excel. ( They can also be sometimes viewed in some other software, such as OpenOffice)
These are all Excel Files: Excel Files.JPG : https://imgur.com/yZO6h1R
Attachment 2916
Text Files .txt .csv
These are some of the extensions indicating that we have text files, ( text documants ).txt .csv
These are usually viewed in Notepad. ( Sometimes they are called Notepad files ) ( They can also be sometimes viewed in Excel, but this is not a good thing to do. It is not a good thing to do, because Excel will display the text in different ways. Your Excel may display them differently to my Excel. Sometimes the values from the text file may be spread across many columns. Sometimes all values will be placed in one column. If a text file like xxxxx.csv or 2.csv or xxxxx.txt is saved using Notepad or Excel, all formatting will be lost: Only text is saved. )
These are all text files: Text Files.JPG : https://imgur.com/9I5nBGm
Attachment 2917
In that last screenshot there are no Excel files. ( The Typ name… Microsoft Office Excel Comma Separated Value ….. is possibly indicating that the text files of extension type .csv can be opened with Excel. But this is also true of the text files with the .txt extension. Microsoft have been stupid to not show all as Text files, or text documants )
For example, 2.csv is not an Excel File
If I save 2.csv using Excel then it will be saved as a text file.
2.csv is a text documant . It can not be anything else. It can also be called a notepad file. It can never be called an Excel file
If I try to open 2.csv in Excel, using Excel, then I may have issues such as discussed in this Thread.
A guess form me is that fixer is thinking that 2.csv can be saved as a comma separated values file and that it can be saved in such a way that by the next opening with Excel it will be formatted in a specific way. This is not possible, because 2.csv can only have text. It does not have cells. It can never look like the results shown by fixer. Those results are for the text being shown in Excel
The following statement is nonsense:
….” the correct output is uploaded plz see i need this result in csv …..”
ThisCanNeverBeTheResult.JPG : https://imgur.com/5UJ1nUL https://excelfox.com/forum/showthrea...ll=1#post13246
Attachment 2918
That can never be the output in a file with the extension of .csv
A file with the extension of .csv can never have any format. It cannot have cells. It is not an Excel file. It can only contain text.
( That text can contain , ; vbTab chr(9) chr(160) chr(88) vbCr vbLf etc. , as well as all normal text and numbers 1234 hsge xyz1234 dhqdh1387ubgrf(&(tg*'#+ etc )
Possibly tomorrow I will make some attempt at a full macro to do "everythnig". But this will require some thought, as I will need to somehow geuss what the asker will finally really want, way into the future, when he finally understands all the issues properly...
Second guessing at the larger picture of what is wanted
Issue of Opening a .csv file .
The misunderstanding and misconceptions of what a .csv file is, are causing all the confusion in this Thread.
Some second guessing of what the further requirement of the project to which the question in this Thread is referring to may help.
The so called “wrong results” are almost always demonstrated by a screenshot which can only be obtained when opening a file, after the macro has produced it. So the issues is not actually related to any of the given macros.
This fact , and any attempt to explain this is/was totally lost in the communications problems encountered
It is a good guess that there remains the misconceptions that a .csv file produced by any macro is somehow an Excel file, and so formatting seen in it when viewing that file in Excel will still be there when the file is later opened. This is false. A .csv file is not an Exel file and on opening all formatting will be lost.
In our case the formatting that is being lost is the positioning of values , one in each cell. On later re opening of the file, we may see all values, as well as the separator , ( whether it be a comma or something else ) all in one column.
Second guessing at the larger picture of what is wanted…
I will add some more here tomorrow…..
( I wait to see if there are any clues from this http://www.eileenslounge.com/viewtopic.php?f=30&t=34610 )
Some interesting things form that post. It seems possibly that you can possibly “fiddle around” to arrange that VBA opens text files in a certain way… or other issues....
( Some notes here https://excelfox.com/forum/showthrea...ll=1#post13343 )