Results 1 to 10 of 115

Thread: Notes tests, text files, manipulation of text files in Excel and with Excel VBA CSV stuff

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,323
    Rep Power
    10

    Strange saving of "csv” files

    Strange saving of “csv” files in Excel
    Lets clarify and look in more detail at the strange saving of the files. In addition when we do it manually, we will run a macro recording
    We will concentrate on the CSV (______)A1B1A2.csv

    Comma delimited
    Initially, if you are starting from Excel with more than one worksheet showing, then an initial pop up warns you of this:
    PopUpWarningOfMultipleSheets.JPG : https://imgur.com/QLscU1a



    This initial pop up will not be shown if you have just one sheet showing at the Save stage

    Assuming we have said OK at the above pop up, or have not had this pop up, we examine now the set of pop ups that occur always..
    In both cases answering with Yes
    On the SaveAs ( or Save ) I get this prompt
    SaveAs or Save CSV (Comma delimited).JPG : : https://imgur.com/SQPHjWI
    WarningOnManualSaveOrSaveAScsv(Comma delimited).JPG : https://imgur.com/QiH8phI


    and these 2 prompts on the Close, ( the second of which is identical to that from the Save or SaveAs )
    this first being strange since I already just Saved the file
    AskToSaveTheChangesAfterSave CSV (Comma delimited).JPG
    : : https://imgur.com/8ih47Ty
    FirstWarningOnManualClose CSV (Comma delimited).jpg : https://imgur.com/dAxojzW


    The second is identical to that on the save : https://imgur.com/SQPHjWI
    SecondWarningOnManualClose CSV (Comma delimited).JPG : https://imgur.com/TY9eBqq


    The files as seen in test editor, or from my function, after is like
    CellA1;CellA2
    CellA3;

    The given macro coding from the macro recorder.
    Code:
    Sub CSVTests()
    ActiveWorkbook.SaveAs Filename:="F:\Excel0202015Jan2016\ExcelFox\vixer\csv Text file Chaos\CSV (Comma delimited)A1B1A2.csv", FileFormat:=xlCSV, CreateBackup:=False
    ActiveWorkbook.Save: ActiveWindow.Close
    End Sub
    If I answer No for the attempt at Save or SaveAs, then I will get the option to save as an Excel file
    Answer No on SaveAs or Save CSV (Comma delimited).JPG : https://imgur.com/uXWo8vz

    If I answer Yes for the attempt at Save or SaveAs, but then on Close , answer No to the first prompt, then I get that first prompt only: I don’t get the second prompt. But,
    _there is a no difference in the macro from the macro recorder
    and
    _there is no difference in the file seen in a text editor after.


    Should I now open manually the file, I find that the file has the values put, one in each cell, to reproduce the file such that it looks exactly as I created it originally
    If I run the macro obtained from the macro recorder, then on the SaveAs or Save , I don’t get any prompt
    On Close I get the first prompt only
    DoYouWantToSaveChangesOnCloseDespiteAlreadySavedCS V with maco.JPG : https://imgur.com/BihBGOH
    If I answer Yes or No , the file is saved without the second prompt as was the manual case.
    Strangely, my file as seen in a text editor is different to that obtained whilst manually doing the recording: It has now commas as the separator/delimiter
    cellA1,cellB1
    cellA2,

    Should I open this now manually, I will find that my row data is spit as before, but , I loose the columns, - that is to say the entire row information, including the , separator appear in the first column. So what is happening is that the , separator is not being recognised as a separator, and instead is being taken as pure text: My file is being seen as a text file having just rows of text, with no separator: In other words it could be regarded as a text file intended to hold the text values to be inserted into column A of an Excel File-
    Row\Col
    A
    B
    1
    CellA1,CellA2
    2
    CellA3,


    The conclusions are that manually closing I always get the ; as separator/delimiter, and by closing with a macro I always get the ,
    Lets just say that again in another way. I do anything manually, and I end up with ; as the separator
    I do anything with a macro and I end up with the , as separator.
    Even if I record a macro when doing it manually, that same macro if run later will end up giving me the , as separator. This last point is likely to be a source of possible confusion



    Just for completeness, the next post will check the same for saving as CSV Macintosh and CSV MS-DOS






    https://www.youtube.com/watch?v=vXyMScSbhk4
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc
    https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq
    Last edited by DocAElstein; 07-09-2023 at 07:35 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

Similar Threads

  1. Replies: 109
    Last Post: 03-29-2024, 07:01 PM
  2. Replies: 4
    Last Post: 01-30-2022, 04:05 PM
  3. Replies: 29
    Last Post: 06-09-2020, 06:00 PM
  4. Notes tests. Excel VBA Folder File Search
    By DocAElstein in forum Test Area
    Replies: 39
    Last Post: 03-20-2018, 04:09 PM
  5. Collate Data from csv files to excel sheet
    By dhiraj.ch185 in forum Excel Help
    Replies: 16
    Last Post: 03-06-2012, 07:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •