ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦sÀɮɦ۰ʳƥ÷ÀɮרÃÂର.xlsx®æ¦¡

[µo°Ý] ¦sÀɮɦ۰ʳƥ÷ÀɮרÃÂର.xlsx®æ¦¡

¤£¦n·N«ä·Q½Ð°Ý¤@¤U¡A§Ú·Q¥´¶}¤@¥÷¦³¥¨¶°ªºexcelÀÉ«á¡A¦bÀÉ®×Àx¦s®É¯à¦P¨B¦Û°Ê³Æ¥÷Àɮרì¡u³Æ¥÷¡v¸ê®Æ§¨
¥BÀɮ׮榡­nÂର.xlsx¡A¦ý§Ú´ú¸Õ¥H¤U¥N½X«á¡A¦Û°Ê³Æ¥÷Àɮרì¡u³Æ¥÷¡v¸ê®Æ§¨¦³¦¨¥\¡A¦ý¥´¶}Àɮ׮ɫo¥X²{¥H¤Uµøµ¡¦Ó¥B§¹¥þ¥´¤£¶}



·Q½Ð°Ý¥H¤U¥N½X¬O§_¦³»~©Î¸Ó¦p¦ó­×¥¿©O!?«D±`·PÁÂ~~~~~~~

thisworkbook¡A¥N½X¡G
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Dim mypath As String, fname As String
fname = "¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd") & ".xlsx"
mypath = ThisWorkbook.Path & "/³Æ¥÷/"
ThisWorkbook.SaveCopyAs mypath & fname
End Sub
*¦v¤k¤@ªTµL»~*

¦^´_ 20# zyzzyva


   «¢~~~~~~«ç»ò¿ì§Ú¦n²Â³á!!!
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 19# msmplay
À³¸Ó¥u¬O¦h¤F¤@­Ó\¡A§ï¦¨mypath = ThisWorkbook.Path & "\³Æ¥÷"¸Õ¸Õ¬Ý¡C

TOP

¦^´_ 17# zyzzyva

z¤j~~~~µ²ªG¤½¥q¤S­n±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
*¦v¤k¤@ªTµL»~*

TOP

¥»©«³Ì«á¥Ñ msmplay ©ó 2016-11-3 12:45 ½s¿è

¦^´_ 17# zyzzyva

z¤j~~¯uªº¥i¥H¤F­C¡IÁÂÁ§A*^O^*
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 16# msmplay
§ï¤F¤@¤U¡AÀ³¸Ó¥i¥H¡A¦A¸Õ¸Õ¬Ý¡C
  1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  2.     Dim mypath As String, fname As String
  3.    
  4.     fname = "\¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd") & ".xlsx"
  5.     mypath = Left(ThisWorkbook.Path, InStrRev(ThisWorkbook.Path, "\") - 1)
  6.     Targetfile = mypath & fname
  7.    

  8.     If Not Me.Saved Then
  9.         Msg = "Do you want to save the changes you made to "
  10.         Msg = Msg & Me.Name & "?"
  11.         Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel)
  12.         Select Case Ans
  13.             Case vbYes
  14.                 Me.Save
  15.             Case vbNo
  16.                 Me.Saved = False
  17.             Case vbCancel
  18.                 Cancel = True
  19.                 Exit Sub
  20.           End Select
  21.     End If
  22.    
  23.     If Me.Saved Then
  24.         Application.DisplayAlerts = False 'Ãö³¬¨t²Îĵ§i°T®§
  25.         'ThisWorkbook.Save '­nÀx¦s¦Û¨­ÀɮסA½Ð¦Û¦æ¿ï¾Ü­n¤£­nÀx¦s
  26.         If Dir(Targetfile) <> "" Then
  27.             If GetAttr(Targetfile) And vbReadOnly Then
  28.                 SetAttr Targetfile, vbNormal
  29.             End If
  30.         End If
  31.         ThisWorkbook.SaveAs mypath & fname, FileFormat:=xlOpenXMLWorkbook
  32.         Application.DisplayAlerts = True '¶}±Ò¨t²Îĵ§i°T®§
  33.     Else
  34.         Me.Saved = True
  35.     End If

  36.     If Dir(Targetfile) <> "" Then
  37.         If GetAttr(Targetfile) Then
  38.             SetAttr Targetfile, vbReadOnly
  39.         End If
  40.     End If
  41.       
  42. End Sub
½Æ»s¥N½X

TOP

¦^´_ 15# zyzzyva

z¤j~~~~¨º½Ð°Ý¥i¥H¦sÀɧYÂл\ÂÂÀɶܡH¤]´N¬OµL½×¦p¦ó¡A­ì©lÀÉ¥u­n¦sÀÉ´N¬O­nÂл\³Æ¥÷°ßŪÀÉ¡A¥i¥HÂæ¶Ü¡H¤S¸Ó¦p¦ó­×§ï©O¡H¯uªº«D±`·PÁÂ~~~~~~
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 14# msmplay
¹ïªü¡A¬O°ßŪÄݩʪº°ÝÃD¡C¦pªG§Æ±æ¤§«áÁÙ¥i¥Hª½±µ¦sÀÉ¡A¥i¯à¦sÀÉ«e­n¥[­ÓÀˬd¡A¦pªGÄݩʤw¸g¬O°ßŪ¡A´N§ï¦^¤@¯ë(vbNormal)

TOP

¥»©«³Ì«á¥Ñ msmplay ©ó 2016-11-2 22:33 ½s¿è

¦^´_ 13# zyzzyva

   z¤j~~~~~´ú¸Õ«á¡Aµo²{²Ä¤@¦¸¦sÀɦ¨¥\¡A¦ý²Ä¤G¦¸­n¦A¦sÀÉ´N·|¥X²{¥H¤U¿ù»~¡A¬O¤£¬O¦]¬°°ßŪÀɵLªkÂл\°ÝÃD©O??

1.PNG
*¦v¤k¤@ªTµL»~*

TOP

¦^´_ 12# msmplay
´ú¸Õ¬Ý¬Ý¡C(¤£­n©ñ¦b®Ú¥Ø¿ý¦pC:\¤U)
  1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  2.     Dim mypath As String, fname As String

  3.     If Not Me.Saved Then
  4.         Msg = "Do you want to save the changes you made to "
  5.         Msg = Msg & Me.Name & "?"
  6.         Ans = MsgBox(Msg, vbQuestion + vbYesNoCancel)
  7.         Select Case Ans
  8.             Case vbYes
  9.                 Me.Save
  10.             Case vbNo
  11.                 Me.Saved = False
  12.             Case vbCancel
  13.                 Cancel = True
  14.                 Exit Sub
  15.           End Select
  16.     End If
  17.    
  18.     If Me.Saved Then
  19.         Application.DisplayAlerts = False 'Ãö³¬¨t²Îĵ§i°T®§
  20.         fname = "\¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd") & ".xlsx"
  21.         mypath = Left(ThisWorkbook.Path, InStrRev(ThisWorkbook.Path, "\") - 1)
  22.         'ThisWorkbook.Save '­nÀx¦s¦Û¨­ÀɮסA½Ð¦Û¦æ¿ï¾Ü­n¤£­nÀx¦s
  23.         ThisWorkbook.SaveAs mypath & fname, FileFormat:=xlOpenXMLWorkbook
  24.         Application.DisplayAlerts = True '¶}±Ò¨t²Îĵ§i°T®§
  25.     Else
  26.         Me.Saved = True
  27.     End If
  28.    
  29.     Targetfile = mypath & fname

  30.     If GetAttr(Targetfile) Then
  31.         SetAttr Targetfile, vbReadOnly
  32.     End If
  33.       
  34. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i¥Í©R¦b©I§l¶¡¡j¦òªû»¡¡G¡u¥Í©R¦b©I§l¶¡¡C¡v¤HµLªkºÞ¦í¦Û¤vªº¥Í©R¡A§óµLªk¾×¦í¦º´Á¡AÅý¦Û¤v¥Ã¦í¤H¶¡¡C¬JµM¥Í©R¥h¨Ó³o»òµL±`¡A§Ú­Ì§óÀ³¸Ó¦n¦n¦a·R±¤¥¦¡B§Q¥Î¥¦¡B¥R¹ê¥¦¡AÅý³oµL±`¡BÄ_¶Qªº¥Í©R¡A´²µo¥¦¯uµ½¬üªº¥ú½÷¡A¬M·Ó¥X¥Í©R¯u¥¿ªº»ù­È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD