dfgfg sddsf fggg dfg sdfsdf
Back up file version 2' Created by Andrew Yu Dim newFileName, oldFileName, tempTabName, tempPath As String Dim versionIndex As Integer Dim i As Integer ' give a version number versionIndex = ActiveWorkbook.Sheets(2).Range("VersionNumber").Value + 1 ActiveWorkbook.Sheets(2).Range("VersionNumber").Value = versionIndex oldFileName = ActiveWorkbook.Name newFileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) & "_emailversion_v" & versionIndex & ".xls" tempPath = ActiveWorkbook.Path 'add new workbook and give a file name that will save in the same directory Workbooks.Add ActiveWorkbook.SaveAs Filename:= _ tempPath & "\" & newFileName, FileFormat _ :=xlNormal, Password:="", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False Application.CutCopyMode = True Windows(oldFileName).Activate For i = 1 To Worksheets.Count Windows(oldFileName).Activate temptapname = Sheets(i).Name Sheets(i).Cells.Copy Windows(newFileName).Activate Worksheets.Add Count:=1, After:=Sheets(Sheets.Count) Selection.PasteSpecial Paste:=xlPasteValues Selection.PasteSpecial Paste:=xlPasteFormats Sheets(Sheets.Count).Name = temptapname Next i Application.CutCopyMode = False ActiveWorkbook.Save ActiveWorkbook.Close End Sub .msgcontent .wsharing ul li { text-indent: 0; } 分享 Facebook Plurk YAHOO!
好站連結:http://ghpewrua.pixnet.net/blog