![]() ![]() If you want to have a location only for Excel for example use this path : /Users/rondebruin/Library/Containers//Data ![]() The folder above you can use to share data between Office programs or with a third party application, so this location will always work if you want to have read and write access. ![]() Note: rondebruin is the user name in this path and I agree that the naming of the folder for Office( UBF8T346G9.Office) is not so nice, but Microsoft must use that of Apple. ![]() Users/rondebruin/Library/Group Containers/UBF8T346G9.Office Trying the code mentioned in the above-linked article, which did not help (and which is why I am posting the original code here).This is the Root folder on my machine that we use in the examples on this page:.Various file types for the FileFormat parameter, but as mentioned, only two types actually worked.Ensuring that version of Excel is checked for and permissions allowed by user.Adding a full path to the input/output file names.MsgBox ("Offline comments exported to " & newFileName) ' Check if software is Office 2016 for MacįileAccessGranted = GrantAccessToMultipleFiles(filePermissionCandidates)ĪctiveWorkbook.SaveAs Filename:=newFileName, FileFormat:=6, CreateBackup:=False NewFileName = Mid(oldFileName, 1, InStrRev(oldFileName, ".") - 1) & timeStamp & ".csv" TimeStamp = Format(Now, "yyyymmddhhmmss") My full script is below: Sub btnExportCSV_Click() However, if FileFormat is set to 6 (.csv) the code will throw the error above. If I change FileFormat to 51 (.xlsx) or 53 (.xlsm) the code will successfully finish. Run-time error '1004':Method 'SaveAs' of object '_Workbook' failed The code works up until the ActiveWorkbook.SaveAs Filename:=newFileName, FileFormat:=6, CreateBackup:=False line, which then throws the error: While a similar issue was documented here ( Getting "method saveas of object _workbook failed" error while trying to save an XLSM as CSV), unfortunately while changing xlCSV to 6 worked for them, this has not worked for me. The code is supposed to allow the user to click a button, which will then export an active worksheet to a CSV file. The issue appears specific to Excel 2016 for Mac when trying to export a CSV. The macro works on Windows platforms with Excel 2016, and on Mac platforms with earlier than the 2016 version. I am running a VBA macro in Excel 2016 for Mac. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |