- ©«¤l
- 109
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 116
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2016-8-4
- ³Ì«áµn¿ý
- 2018-10-22
|
¦^´_ 16# msmplay
§ï¤F¤@¤U¡AÀ³¸Ó¥i¥H¡A¦A¸Õ¸Õ¬Ý¡C- Private Sub Workbook_BeforeClose(Cancel As Boolean)
- Dim mypath As String, fname As String
-
- fname = "\¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd") & ".xlsx"
- mypath = Left(ThisWorkbook.Path, InStrRev(ThisWorkbook.Path, "\") - 1)
- Targetfile = mypath & fname
-
- If Not Me.Saved Then
- Msg = "Do you want to save the changes you made to "
- Msg = Msg & Me.Name & "?"
- Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel)
- Select Case Ans
- Case vbYes
- Me.Save
- Case vbNo
- Me.Saved = False
- Case vbCancel
- Cancel = True
- Exit Sub
- End Select
- End If
-
- If Me.Saved Then
- Application.DisplayAlerts = False 'Ãö³¬¨t²Îĵ§i°T®§
- 'ThisWorkbook.Save 'nÀx¦s¦Û¨ÀɮסA½Ð¦Û¦æ¿ï¾Ün¤£nÀx¦s
- If Dir(Targetfile) <> "" Then
- If GetAttr(Targetfile) And vbReadOnly Then
- SetAttr Targetfile, vbNormal
- End If
- End If
- ThisWorkbook.SaveAs mypath & fname, FileFormat:=xlOpenXMLWorkbook
- Application.DisplayAlerts = True '¶}±Ò¨t²Îĵ§i°T®§
- Else
- Me.Saved = True
- End If
- If Dir(Targetfile) <> "" Then
- If GetAttr(Targetfile) Then
- SetAttr Targetfile, vbReadOnly
- End If
- End If
-
- End Sub
½Æ»s¥N½X |
|