- ©«¤l
- 218
- ¥DÃD
- 73
- ºëµØ
- 0
- ¿n¤À
- 290
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN10
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2014-5-19
- ³Ì«áµn¿ý
- 2022-11-29
|
¦^´_ 17# zyzzyva
z¤j~~~~µ²ªG¤½¥q¤Sn±N³Æ¥÷Àɧï©ñ©ó¹³¤§«e¼gªº¨º¼Ë¡A©ñ¦bÀɮפU¤@¼h³Æ¥÷¸ê®Æ§¨¤ºmypath = ThisWorkbook.Path & "\³Æ¥÷\"
µ²ªG§Ú¹Á¸Õ§ï¤F¤@¤U¦ý³£¤£¹ï¡A¥i¥H¦A³Â·Ð±z¶Ü~~~~
¬õ¦â¬O§Ú¦Û¤v¶Ã§ïªº
- Private Sub Workbook_BeforeClose(Cancel As Boolean)
- Dim mypath As String, fname As String
- fname = "\¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd") & ".xlsx"
- mypath = ThisWorkbook.Path & "\³Æ¥÷\"
- 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
|
|