excel是否可以执行以下操作:
1. User clicks 'SEND SHEET'
2. Script is ran on a temporary sheet, modifying it's content
3. Temporary sheet is attached to the email
4. The original sheet does not change
电子邮件部分不是问题,但我不知道如何在一个自包含的Excel文件中执行第2步。
如果我的问题不清楚,请提出问题
答案 0 :(得分:0)
以下是将单个工作表复制到新工作簿,对副本进行更改,保存副本以及关闭副本的示例。 (原件未更改)
Sub MakeACopy()
ActiveSheet.Copy
'
' We are now in a new workbook
'
Sheets("Sheet1").Range("A1").Value = "stuff"
ActiveWorkbook.SaveAs Filename:="Temporary.xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
ActiveWorkbook.Close
'
' We are now back in the original workbook
'
ActiveWorkbook.Close
End Sub