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

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

¦^´_ 10# zyzzyva


   z¤j~~~~´ú¸Õ¤w¦¨¥\¡A¯uªº¶W¯Å·PÁªºËç
*¦v¤k¤@ªTµL»~*

TOP

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

¦^´_ 10# zyzzyva


   z¤j~~¥i¥H½Ð±Ð¨â­Ó©µ¦ùªº°ÝÃD¶Ü?
´N¬O¦pªG¦Û°Ê³Æ¥÷¦ì¸m§Æ±æ§ï¬°Àɮתº¤W¼h¸ê®Æ§¨¡A¸Ó¦p¦ó­×§ï©O?
¨Ò¦p:ÀÉ®× ©ñ©ó C:\Users\Downloads\´ú¸Õ¡A§Æ±æ¦Û°Ê³Æ¥÷Àɮשó C:\Users\Downloads


¥t¥~¦pªG§Æ±æ¦Û°Ê³Æ¥÷ªºÀɮשT©w¦s¬°°ßŪÀÉ¡A¤S¸Ó¦p¦ó­×§ï©O?
¨Ò¦p: ´ú¸ÕÀÉ.xlsm ¦sÀɮɦ۰ʳƥ÷¬° ´ú¸ÕÀÉ.xlsx(°ßŪ)
*¦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

¥»©«³Ì«á¥Ñ 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

¦^´_ 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

¦^´_ 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

¦^´_ 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

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

¦^´_ 17# zyzzyva

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

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

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

TOP

        ÀR«ä¦Û¦b : °µ¸Ó°µªº¨Æ¬O´¼¼z¡A°µ¤£¸Ó°µªº¨Æ¬O·Mè¡C
ªð¦^¦Cªí ¤W¤@¥DÃD