我有一个宏来导出当前页面,没有任何公式或代码。有一些问题。
Sub ExportXLSX()
Application.EnableEvents = False
Dim MyPath As String
Dim MyFileName As String
MyFileName = Sheets("Order Summary").Range("B2").Value & "_" & Format(Date, "yyyymmdd")
If Not Right(MyFileName, 4) = ".xlsx" Then MyFileName = MyFileName & ".xlsx"
Sheets("Order Summary").Copy
With Application.FileDialog(msoFileDialogFolderPicker)
.Title = "Select where you want to save"
.AllowMultiSelect = False
.InitialFileName = "" 'Start folder path for the file picker.
If .Show <> -1 Then GoTo NextCode
MyPath = .SelectedItems(1) & "\"
End With
NextCode:
With ActiveWorkbook
.ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value '<~~ converts contents of XLSX file to values only
.SaveAs filename:=MyPath & MyFileName, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
.Close False
End With
Application.EnableEvents = True
End Sub
基本上想要将文档剥离为只有愚蠢的文本,以便我可以通过电子邮件发送它。
由于
答案 0 :(得分:1)
您可以通过执行以下操作来删除验证:
Activesheet.Cells.Validation.Delete
(虽然限定表格名称是理想的)。
您还可以通过执行以下操作来遍历工作表中的形状:
Dim shp as Shape
For each shp in ActiveSheet.Shapes
shp.delete
Next
这两个步骤应删除所有形状,并应删除所有数据验证。