本題應不難吧?我想帶出一點:
很多朋友寫編碼時會改變 Excel 的設定(每人的設定喜好不定) , 但沒有還原,這對原作者有用,其他人就受苦。
我的編碼如下:
Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWindow.WindowState = xlMaximized
For x = Windows.Count To 2 Step -1
Windows(x).Close
Next
ThisWorkbook.Saved = True
End Sub
Sub Test() 'Workbook_Open()
With ActiveWindow
.WindowState = xlNormal
.Top = 50
.Left = 50
.Width = 400
.Height = 400
End With
ActiveWindow.NewWindow
With ActiveWindow
.WindowState = xlNormal
.Top = 50
.Left = 500
.Width = 400
.Height = 400
End With
End Sub
|