+ Reply to Thread
Results 1 to 4 of 4

Excel 2016 VBA to Export worksheet to CSV file on Mac OS

  1. #1
    Registered User
    Join Date
    07-21-2018
    Location
    Cairo
    MS-Off Ver
    2016 for Mac
    Posts
    2

    Excel 2016 VBA to Export worksheet to CSV file on Mac OS

    I am using the VBA code GenerateCSV to convert sheet to csv file on Excel and it is working on PC but not on Mac .
    i need to convert the VBA code to work with Mac


    Public Sub GenerateCSV(DataSheet)

    Dim path As String
    Dim FileName As String
    FileName = InputBox("I will save the CSV into the same folder " & vbCrLf & " Please input the CSV File Name " & vbCrLf & "( Example : ABC.CSV ) ")
    path = ActiveWorkbook.path & "\" & FileName

    MsgBox path
    'MsgBox DataSheet

    Dim xWs As Worksheet
    Dim xcsvFile As String
    For Each xWs In Application.ActiveWorkbook.Worksheets

    Select Case True
    Case xWs.Name = DataSheet

    xWs.Copy
    xcsvFile = path
    Application.ActiveWorkbook.SaveAs FileName:=xcsvFile, FileFormat:=xlCSV, CreateBackup:=False
    Application.ActiveWorkbook.Saved = True
    Application.ActiveWorkbook.Close
    Case Else
    End Select

    Next


    End Sub

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,910

    Re: Excel 2016 VBA to Export worksheet to CSV file on Mac OS

    What you probably need to do is change this line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    See this URL: https://msdn.microsoft.com/en-us/vba...meration-excel
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,910

    Re: Excel 2016 VBA to Export worksheet to CSV file on Mac OS

    If you want to keep it portable, use the following logic"
    Please Login or Register  to view this content.
    The above courtesy of: https://www.rondebruin.nl/mac/mac001.htm

  4. #4
    Registered User
    Join Date
    07-21-2018
    Location
    Cairo
    MS-Off Ver
    2016 for Mac
    Posts
    2

    Re: Excel 2016 VBA to Export worksheet to CSV file on Mac OS

    Thanks , I will try the solution

+ 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. Moving Data from one excel 2016 worksheet to a excel 2010 worksheet
    By Willows59 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2018, 05:56 PM
  2. Replies: 1
    Last Post: 09-18-2017, 08:27 AM
  3. Replies: 2
    Last Post: 09-03-2017, 06:10 AM
  4. Opening CSV file in Excel 2016
    By paula10 in forum Excel General
    Replies: 3
    Last Post: 08-01-2017, 04:34 AM
  5. export limit - excel 2016
    By helloexcel1 in forum Excel General
    Replies: 4
    Last Post: 06-29-2016, 01:03 PM
  6. Replies: 1
    Last Post: 03-14-2016, 12:41 PM
  7. Export a specific worksheet to another excel file.
    By paradoxofthecat in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-01-2015, 10:16 AM

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