+ Reply to Thread
Results 1 to 3 of 3

CSV Generation macro not generating a .csv file

  1. #1
    Registered User
    Join Date
    06-04-2022
    Location
    Prague
    MS-Off Ver
    Office 365
    Posts
    7

    Post CSV Generation macro not generating a .csv file

    Hello!
    Can you please advise what is wrong with my macro called "SaveEachWorksheet"? When running it, the generated csv files have just the csv extension in the file name, but they are somehow saved as .xlsx files, which is not the expected output....

    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: CSV Generation macro not generating a .csv file

    Hi Beck82,

    just adding an extension to the filename will not save it as CSV but stating which FileFormat you want to save like

    Please Login or Register  to view this content.
    Ciao,
    Holger
    Last edited by HaHoBe; 09-15-2022 at 08:57 AM. Reason: changing ActiveWorkbook to ThisWorkbook
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: CSV Generation macro not generating a .csv file

    Hi Beck82,

    if you do not include the FileFormat when using SaveAs Excel will always save the file in the format you may find at File/Options/Save. In your case that is the format xlsx/xlOpenXMLWorkbook or number 51 on Windows.

    For more information about SaveAs you may have a look at Use VBA SaveAs in Excel 2007-2016, more information about the FileFormat may be found at XlFileFormat enumeration (Excel).

    Ciao,
    Holger
    Last edited by HaHoBe; 09-15-2022 at 10:57 AM. Reason: link to site of Ron de Bruin corrected

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Avoiding the automatic email generation by Excel macro file button
    By Sekars in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-20-2019, 10:39 PM
  2. [SOLVED] Generation of PDF copy of Salary Slips from Excel master file using macro
    By Kaustav Bhaumik in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-30-2017, 05:02 PM
  3. Tmp File Generation
    By koshish in forum Excel General
    Replies: 4
    Last Post: 10-26-2014, 01:13 PM
  4. Tmp file generation
    By MEH NAAZ in forum Excel General
    Replies: 1
    Last Post: 10-22-2014, 03:40 AM
  5. Macro needed for automatic generation of file
    By witsonjoyet in forum Excel General
    Replies: 0
    Last Post: 04-23-2014, 08:18 AM
  6. CSV file generation adds commas after end of row
    By DNA42 in forum Excel General
    Replies: 0
    Last Post: 04-19-2012, 07:01 AM
  7. [SOLVED] embedding a macro when generating a CSV file
    By Fred in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-15-2006, 08:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1