系统:Windows 10
关于文件夹的操作在这里: Part 1:Excel工作簿的操作
Sub Excel文件操作()
'
CurrentDir = ThisWorkbook.Path & '\'
NewFileName = '测试文件.xlsx'
NewFileAddr = CurrentDir & NewFileName
If Dir(NewFileAddr) <> '' Then
MsgBox '文件重复'
Kill NewFileAddr
End If
Workbooks.Add
ActiveWorkbook.SaveAs Filename:=NewFileAddr, FileFormat _
:=xlOpenXMLWorkbook, CreateBackup:=False
Set wb = ActiveWorkbook
wb.Save
wb.Close
End Sub
录制宏链接: sht3.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
'G:\【10】微信\【3】文章\2016.09.18\test2.pdf', _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
Sheets(Array('测试1', '测试2', '测试3')).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
'G:\【10】微信\【3】文章\2016.09.18\test2.pdf', Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False Part 2:Excel工作簿内工作表操作
Sheets.Add After:=sht2
Set sht6 = ActiveSheet
sht6.Name = '新建'
以上为本次的学习内容,下回见
|
|