Results 1 to 10 of 117

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

Threaded View

DocAElstein Notes tests, text files,... 06-16-2020, 11:14 AM
DocAElstein Strange saving of "csv”... 06-16-2020, 11:14 AM
DocAElstein This post repeats the... 06-27-2020, 02:57 PM
DocAElstein test PK ! U6»+w ( ... 07-17-2020, 01:23 AM
DocAElstein Post for later use 07-20-2020, 03:19 PM
DocAElstein Post for later use to keep... 11-24-2020, 01:45 PM
DocAElstein Post for later use to keep... 11-24-2020, 01:46 PM
DocAElstein Post for later use to keep... 11-24-2020, 01:46 PM
DocAElstein Post for later use to keep... 11-24-2020, 01:46 PM
DocAElstein For Ozgrid post results see... 11-24-2020, 02:23 PM
DocAElstein continued from last post ... 11-24-2020, 02:36 PM
DocAElstein Post for later use to keep... 11-24-2020, 01:45 PM
DocAElstein continued from last post ... 11-24-2020, 04:15 PM
DocAElstein tt2.txt vbCr & vbLf &... 11-25-2020, 02:47 AM
DocAElstein Modified Sub... 11-26-2020, 04:04 PM
DocAElstein Modified Sub... 11-26-2020, 04:05 PM
DocAElstein Macro for this post... 11-26-2020, 05:37 PM
DocAElstein In support of this Thread... 11-27-2020, 12:33 PM
DocAElstein tt.txt Approximately a... 11-26-2020, 02:45 PM
DocAElstein In support of this Thread... 11-27-2020, 12:33 PM
DocAElstein Dec 2020-11-29 If I make... 11-29-2020, 12:28 PM
DocAElstein Following on, and in support... 02-17-2021, 06:53 PM
DocAElstein later... 02-17-2021, 06:54 PM
DocAElstein post for later use ... later 02-17-2021, 06:54 PM
DocAElstein post ti get URL 02-17-2021, 06:54 PM
DocAElstein later ,,,......... 02-17-2021, 06:55 PM
DocAElstein later ----------- 02-17-2021, 06:55 PM
DocAElstein post for later... 02-17-2021, 06:55 PM
DocAElstein later ... 02-17-2021, 06:55 PM
DocAElstein Convert Excel data range to... 02-17-2021, 06:56 PM
DocAElstein post for later use ... 02-17-2021, 06:53 PM
DocAElstein Test csv file upload 08-17-2021, 11:50 PM
DocAElstein Post for later use, to get... 08-18-2021, 10:36 AM
DocAElstein ( this is post 35 15601 , it... 08-18-2021, 11:24 AM
DocAElstein ( Post #37 15602 ) ... 08-18-2021, 11:35 AM
DocAElstein ( Post #38 15603 ) ... 08-18-2021, 11:43 AM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein Some notes in support of... 08-18-2021, 10:52 AM
DocAElstein Post #36 15604 ( copied... 08-18-2021, 11:24 AM
DocAElstein ps1 PowerShell script text... 02-08-2022, 09:32 PM
DocAElstein Convert Excel data range to... 02-17-2021, 06:56 PM
DocAElstein Test csv file upload 08-17-2021, 11:50 PM
DocAElstein Post for later use, to get... 08-18-2021, 10:36 AM
DocAElstein Clipboard Spam Link Wonks 08-18-2021, 11:24 AM
DocAElstein ( Post #37 15602 ) ... 08-18-2021, 11:35 AM
DocAElstein ( Post #38 15603 ) ... 08-18-2021, 11:43 AM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein Some notes in support of... 08-18-2021, 10:52 AM
DocAElstein Post #36 15604 ( copied... 08-18-2021, 11:24 AM
DocAElstein I hit a problem later I hit... 02-08-2022, 09:32 PM
DocAElstein ( this is post 35 15601 , it... 08-18-2021, 11:24 AM
DocAElstein Post #36 15604 ( copied... 08-18-2021, 11:24 AM
DocAElstein ( Post #37 15602 ) ... 08-18-2021, 11:35 AM
DocAElstein ( Post #38 15603 ) ... 08-18-2021, 11:43 AM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein This is post... 02-08-2022, 09:32 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein In support of this post ... 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein jjhgjhghjhjg 08-18-2021, 03:29 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Another post for later use 02-08-2022, 09:32 PM
DocAElstein Some extra stuff for this... 06-01-2022, 01:25 AM
DocAElstein In support of this main forum... 06-13-2022, 02:09 PM
DocAElstein In support of this main forum... 06-13-2022, 02:43 PM
DocAElstein In support of this main forum... 09-14-2022, 12:07 PM
DocAElstein Some notes in support of this... 09-29-2022, 01:33 PM
DocAElstein This is post... 10-02-2022, 06:21 PM
DocAElstein This is post... 10-02-2022, 06:21 PM
DocAElstein In support of this main forum... 09-14-2022, 12:07 PM
DocAElstein Some notes in support of this... 09-29-2022, 01:33 PM
DocAElstein This is post... 10-02-2022, 06:21 PM
DocAElstein This is post... 10-02-2022, 06:21 PM
DocAElstein Some extra notes for this... 08-22-2023, 12:56 PM
DocAElstein Some extra notes for this... 08-22-2023, 12:56 PM
DocAElstein Some extra notes for this... 08-22-2023, 12:56 PM
DocAElstein Some extra notes for this... 08-22-2023, 12:56 PM
DocAElstein https://i.postimg.cc/cKzrrVTK/... 08-23-2023, 07:24 PM
DocAElstein ( macro used in atttched... 08-24-2023, 01:48 PM
DocAElstein later ... 08-24-2023, 06:23 PM
DocAElstein I am going jogging in the Sun... 08-24-2023, 07:39 PM
DocAElstein I can't take my camera,... 08-24-2023, 09:15 PM
DocAElstein mmghg ... 08-25-2023, 11:57 AM
DocAElstein jhkjhh 08-25-2023, 01:51 PM
DocAElstein vmvv 08-26-2023, 12:15 AM
DocAElstein hkjhg 08-26-2023, 09:35 PM
DocAElstein Some Extra notes for this... 09-02-2023, 11:38 AM
DocAElstein Some Extra notes for this... 09-02-2023, 11:48 AM
DocAElstein even more Later fsdf ... 09-06-2023, 03:40 PM
DocAElstein FileSystemObject OpenTextFile... 09-02-2023, 11:48 AM
DocAElstein even more Later fsdf ... 09-06-2023, 03:40 PM
DocAElstein This is post 111, Page 12... 02-05-2024, 03:13 PM
DocAElstein even more Later fsdf ... 09-06-2023, 03:40 PM
DocAElstein This is post 112, Page 12... 02-07-2024, 05:54 PM
DocAElstein Reply to last post, (Reply to... 03-04-2024, 02:05 PM
DocAElstein Some notes in support of this... 03-04-2024, 02:04 PM
DocAElstein This is post ... 03-04-2024, 02:39 PM
DocAElstein Notes in support of this post... 02-23-2025, 12:13 AM
DocAElstein test ... 02-23-2025, 12:10 AM
Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10

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

    One important note at the outset of these notes is that my Excel is default German. I expect therefore issues likely to arise in anything to do with use of a comma , because often the comma , in English for certain things in Excel is replaced with the semi colon ; in German Excel.

    Wot’s in a .csv file
    In many Excel versions, you have the choice of three different Save As options related to .csv extension files https://excel.tips.net/T002519_Comma...C_and_Mac.html

    So lets have a quick look at what the differences are…
    In each of the 3 cases I will
    make a virgin default template, save it
    make a virgin default template, put a value in first cell, save it
    make a virgin default template, put a value in first 2 cells, save it
    make a virgin default template, put a value in first 2 cells, and in the cell A2, save it
    ( Initially, when I put values in, I wont hit the Enter after: Initially I want to avoid purposely doing something that may introduce a carriage return or line feed. I will then look further at that issue later )
    After this I will investigate the made files , ( using , for example, my Sub WtchaGot_Unic_NotMuchIfYaChoppedItOff(ByVal strIn As String) ) ' https://excelfox.com/forum/showthrea...ts-of-a-string ' https://excelfox.com/forum/showthrea...ll=1#post11015
    https://excelfox.com/forum/showthrea...ll=1#post13699


    Here are the results ( It is a summary of what my function tells me is in those made files ) :
    CSV (Comma delimited)Empty.csv vbCr & vbLf
    CSV (Macintosh)Empty.csv vbCr & vbLf
    CSV (MS-DOS)Empty.csv vbCr & vbLf
    CSV (Comma delimited)A1.csv cellA1 "cellA1" & vbCr & vbLf
    CSV (Macintosh)A1.csv cellA1 "cellA1" & vbCr & vbLf
    CSV (MS-DOS)A1.csv cellA1 "cellA1" & vbCr & vbLf
    CSV (Comma delimited)A1B1.csv cellA1;cellB1 "cellA1" & ";" & "cellB1" & vbCr & vbLf
    CSV (Macintosh)A1B1.csv cellA1;cellB1 "cellA1" & ";" & "cellB1" & vbCr & vbLf
    CSV (MS-DOS)A1B1.csv cellA1;cellB1 "cellA1" & ";" & "cellB1" & vbCr & vbLf
    CSV (Comma delimited)A1B1A2.csv cellA1;cellB1
    callA2;
    "cellA1" & ";" & "cellB1" & vbCr & vbLf & "callA2" & ";" & vbCr & vbLf
    CSV (Macintosh)A1B1A2.csv cellA1;cellB1
    callA2;
    "cellA1" & ";" & "cellB1" & vbCr & "callA2" & ";" & vbCr & vbLf
    CSV (MS-DOS)A1B1A2.csv cellA1;cellB1
    callA2;
    "cellA1" & ";" & "cellB1" & vbCr & vbLf & "callA2" & ";" & vbCr & vbLf

    Important Conclusions are
    _ the Macintosh distinguishes itself with a carriage return character, vbCr , as the line separator for introduced lines
    _ There is always a last vbCr & vbLf – Note this means that for a single line, or empty file, we could not tell if we had a Macintosh

    When closing the file, I was prompted to answer if I wanted to save changes or not. ( I chose yes in the last experiment ). This is strange since I had previously saved the files before closing
    DoYouWantToSaveChangesOnCloseDespiteAlreadySavedCS V.JPG : https://imgur.com/nfnVwSF
    But it does not seem to have any effect if I chose Yes or No
    Some other observations.
    If I use a simple macro, as below, to save and close the file ( and except the changes, which I am still strangely asked for , with Yes), then I get commas instead for the separator/delimiter
    Code:
    Sub SaveCSVviaVBA()
     ActiveWorkbook.Save
     ActiveWorkbook.Close
    End Sub
    I get the same results for answering No

    These macros gives me the same results
    Code:
    Sub SaveAsCSVviaVBA()
     ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "csv Text file Chaos\" & "CSV (Comma delimited)A1B1A2" & ".csv"
     ActiveWorkbook.Close
    End Sub 
    Code:
    Sub SaveAsCSVviaVBAxlcsv()
     ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & "csv Text file Chaos\" & "CSV (Comma delimited)A1B1A2" & ".csv", FileFormat:=xlCSV
     ActiveWorkbook.Close
    End Sub








    Ref
    https://excelfox.com/forum/showthrea...mediate-Window
    https://excelfox.com/forum/showthrea...ed-Text-String
    https://excel.tips.net/T002519_Comma...C_and_Mac.html
    https://excelribbon.tips.net/T010280...for_PC_and_Mac
    https://sites.google.com/a/madrocket...svs?authuser=0
    https://excelribbon.tips.net/T009508...ariations.html

    Eileen’sLoungeTextFiles
    http://www.eileenslounge.com/viewtop...274367#p274367


    https://excel.tips.net/T003232_Speci...n_a_Macro.html -- printer line save ……. This works this way by design in VBA. The Excel implementation of the export routines for VBA always use whatever the Windows regional settings are to determine how items in a CSV should be separated. Specifically, the routine looks at the List Separator field for the delimiter. This means that you can, if desired, change the delimiter to a semicolon by changing the List Separator setting in your regional settings configuration.
    If you don't want to change the regional settings, then you can instead write your own macro that will output the file in any way you desire. Consider, for a moment, the following macro, which will output the file:











    https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO
    https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2
    https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg
    https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg
    Last edited by DocAElstein; 07-09-2023 at 07:31 PM.

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
  •