gpt4 book ai didi

Excel - "Runtime error ' 100 4' Method ' 对象的“另存为”_'workbook' 失败“Macbook

转载 作者:行者123 更新时间:2023-12-04 19:51:22 26 4
gpt4 key购买 nike

尝试通过 makro 在我的桌面上将工作表另存为 .csv

我不断收到“运行时错误‘1004’对象‘_‘workbook’的方法‘SaveAs’失败”

Sub Export()

Dim wb As Workbook
Dim sht5 As Worksheet
Dim r As Long
Dim LastRow As Long

Set sht5 = ThisWorkbook.Worksheets("ExportCsv") 'Sheet to export as CSV
Set wb = Application.Workbooks.Add

sht5.Copy Before:=wb.Worksheets(wb.Worksheets.Count)

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For r = LastRow To 1 Step -1

If Cells(r, 10) = 0 Then

Rows(r).Delete

End If

Next r

Application.DisplayAlerts = False 'Possibly overwrite without asking
wb.SaveAs Filename:="/Users/thomasduus/Desktop/1.csv", FileFormat:=xlCSV, CreateBackup:=False

Application.DisplayAlerts = True
wb.Close SaveChanges:=False
End Sub

最佳答案

我相信 mac 文件位置的工作方式类似于:

Wb.SaveAs "Macintosh HD:Users:thomasduus:Desktop:1.csv"

关于Excel - "Runtime error ' 100 4' Method ' 对象的“另存为”_'workbook' 失败“Macbook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64247363/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com