ªð¦^¦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»~*

¦^´_ 1# msmplay
  1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  2. Dim mypath As String, fname As String
  3. fname = "¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd") & ".xlsx"
  4. mypath = ThisWorkbook.Path & "\³Æ¥÷\"
  5. ThisWorkbook.SaveAs mypath & fname, FileFormat:=xlOpenXMLWorkbook
  6. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# msmplay
SaveCopyAs¦n¹³¨S¿ìªk«ü©w®æ¦¡¡C¨S·Q¨ì§ó¦nªº¿ìªk¡A³o­Ó¸Õ¸Õ¬Ý¡C
  1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  2.     On Error Resume Next
  3.     Dim mypath As String, fname As String
  4.    
  5.     If Me.Saved = True Then
  6.         fname = "¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd")
  7.         mypath = ThisWorkbook.Path & "/³Æ¥÷/"
  8.         ThisWorkbook.SaveCopyAs mypath & fname & ".xlsm"
  9.         
  10.         Workbooks.Open (mypath & fname & ".xlsm")
  11.         Application.DisplayAlerts = False
  12.         ActiveWorkbook.SaveAs mypath & fname, FileFormat:=51
  13.         Application.DisplayAlerts = True
  14.         ActiveWorkbook.Close
  15.         Kill (mypath & fname & ".xlsm")
  16.     End If
  17.    
  18. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# lpk187

   l¤j~~~~«D±`·PÁÂÀ°¦£¡A¤£¹L¤p©f´ú¸Õ¤§«á­ìÀÉ¥X²{¥H¤U¿ù»~°T®§¡A¥i¥H¦A½Ð±zÀ°¦£¬Ý¬Ý¶Ü~~~~




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

TOP

¥»©«³Ì«á¥Ñ zyzzyva ©ó 2016-8-21 00:40 ½s¿è

3Fªºcode¦³ÂIbug¡A¤@©w­n¥ý¦sÀɦAÃö³¬¤~¦³¥Î¡A¦pªG¬O¦b¹ï¸Üµøµ¡¥X¨Ó¦A«ö¡u¬O¡v¦sÀÉ´N¤£·|§@¥Î¡C
À³¸Ó¬O¨Æ¥óIJµo¥ý«áªº°ÝÃD¡A­n¦A­×§ï¤@¤U¡C

TOP

¦^´_ 3# zyzzyva

z¤j~~~~~±z¤S¥X¤â¬Û§U¤F!!!«D±`·PÁ³á~~~~~
¤£¹L´ú¸Õ¤§«á¡AÁöµM¤w¸g«ö¹L¦sÀÉ¡A¦ý¥u­nÃö³¬ÀÉ®×®ÉÁÙ¬O·|¦A¥X²{¤@¦¸¥H¤Uªº°T®§µøµ¡¡A½Ð°Ý¬O§_¥i¸õ¹L¦¹¹ï¸Üµøµ¡©O!?

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

TOP

¥»©«³Ì«á¥Ñ zyzzyva ©ó 2016-8-21 00:56 ½s¿è

¦^´_ 6# msmplay
©Ç©Ç¡A§Ú¥ÎªÅ¥Õªº´ú¨S¦³³o­Ó°ÝÃD¡A¥i¥H¥ý¦bkill¤U¤@¦æ¥[­ÓActiveWorkbook.Save¡Abug©ú¤Ñ¦³ªÅ¦A¬ã¨s¡C

TOP

¦^´_ 4# msmplay
  1. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  2. Dim mypath As String, fname As String
  3. fname = "¦Û°Ê³Æ¥÷" & Format(Date, "yymmdd") & ".xlsx"
  4. mypath = ThisWorkbook.Path & "\³Æ¥÷\"
  5. Application.DisplayAlerts = False 'Ãö³¬¨t²Îĵ§i°T®§
  6. ThisWorkbook.Save '­nÀx¦s¦Û¨­ÀɮסA½Ð¦Û¦æ¿ï¾Ü­n¤£­nÀx¦s
  7. ThisWorkbook.SaveAs mypath & fname, FileFormat:=xlOpenXMLWorkbook
  8. Application.DisplayAlerts = True '¶}±Ò¨t²Îĵ§i°T®§
  9. End Sub
½Æ»s¥N½X

TOP

¦^´_ 6# msmplay
­ì¦]«D±`©úÅã¡A¦³¥¨¶°ªºªº¬¡­¶Ã¯ÀɮסA
¦p¦s¦¨ .xlsx «¬ºA¡A¨ä¥¨¶°·|ÀH¤§®ø¥¢ªº¡C

TOP

¦^´_ 6# msmplay
«á¨Ó·Q¤F¤@¤U¡A¦pªG¨S¦³¤@©w­n¥ÎSaveCopyAsªº­ì¦]¡A¥Îl¤jªº¤è¦¡ª½±µSaveAs¤ñ¸û¦n¡C
¤£¹L³Ì¦nÁÙ¬O¥[­Óif§PÂ_¡A¤£µM¦pªGÃö³¬ªº®É­Ô¿ï§_¡A³Æ¥÷ÁÙ¬O·|°õ¦æ¡A­ì¨Ó¥¿½Tªº³Æ¥÷´N³Q»\±¼¤F¡C
®³ºô¸ô¤W¸òl¤jªºcode²Õ¦X§ï¤F¤@¤U¡A±z¦A°Ñ¦Ò¬Ý¬Ý¡C
  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 = ThisWorkbook.Path & "\³Æ¥÷\"
  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. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤H¥Í³Ì¤jªº¦¨´N¬O±q¥¢±Ñ¤¤¯¸°_¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD