|
下記マクロで処理していますがプレヴュー画面へ移行する時時間がかかるような気がします。処理速度を上げる方法はありますか。
Sub セルの値をファイル名にする()
Dim fm As String
Dim fs As Variant
ChDrive "S"
ChDir "S:\1ABT\1612\決定"
Columns("A:B").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.984251968503937)
.BottomMargin = Application.InchesToPoints(0.984251968503937)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.511811023622047)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Columns("A:B").EntireColumn.AutoFit
Columns("C:E").Select
Selection.ColumnWidth = 5.5
Columns("F:F").ColumnWidth = 9.5
Columns("G:G").ColumnWidth = 8.25
Columns("G:G").EntireColumn.AutoFit
ActiveWindow.SelectedSheets.PrintPreview
ActiveWindow.SelectedSheets.PrintOut Copies:=1
With ThisWorkbook.ActiveSheet
fm = .Range("A2").Text & "(" & .Range("F2").Text & ")"
End With
fs = Application.GetSaveAsFilename(fm, "MicrosoftExcelブック(*.xls),*.xls", , "ファイルを保存する", "保存")
If fs = False Then End
ThisWorkbook.SaveAs fs
End Sub
|
|