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

[µo°Ý] Àɮ׶}±Ò¥t¦s½Æ¥»

[µo°Ý] Àɮ׶}±Ò¥t¦s½Æ¥»

¥»©«³Ì«á¥Ñ cowww ©ó 2023-5-22 12:00 ½s¿è

½Ð±Ð½×¾Âªº¤j¤j­Ì

§Ú·Q§â¥t¦s·sÀɧ令¥ý§PÂ_Àɮ׬O§_¦³³Q¶}±Ò
¦pªG¦³¡A´N¥t¦s½Æ¥»
¦pªG¨S¦³¡A´Nª½±µÀx¦s

­ì¥ýªº»yªk
  ThisWorkbook.SaveAs fileName:= _
        "\\group.com\dept\³Æ¥÷\123\«æ¥ó±M®×ª¬ºA°lÂÜ_v2_0.xlsm", WriteResPassword:="6112"

¥H¤U¬O­×§ïªº»yªk¡A½Ð°Ý­þ¸Ì¦³¿ù»~
    Dim fileName As String
    fileName = "\\shl-group.com\dept\«æ¥ó±M®×ª¬ºA°lÂÜ_v2_0.xlsm"
   
    If IsFileOpen(fileName) Then
        Dim copyName As String
        copyName = Left(fileName, Len(fileName) - 5) & "_Copy.xlsm"
        
        ThisWorkbook.SaveCopyAs fileName:=copyName, WriteResPassword:="6112"
        
    Else
        ThisWorkbook.SaveAs fileName, WriteResPassword:="6112"
    End If

¥»©«³Ì«á¥Ñ quickfixer ©ó 2023-5-23 05:59 ½s¿è

§Aµ{¦¡½X¦³¤Ö,isfileopen¤£¬O¤º«Øªº¥\¯à
À³¸ÓÁÙ­n¦³¤@­Ófunction isfileopen(filename as string),¦Û«Øªº°Æµ{¦¡

TOP

¦^´_ 2# quickfixer

«D±`·PÁÂquickfixer¤j¤jªº¸Ñ´b

GPTµ¹§Ú¤F³o¤@¬q»yªk¡A´ú¸Õ¤W¬O¨S¦³°ÝÃDªº
Function IsFileOpen(filePath As String) As Boolean
    Dim fileNum As Integer
    fileNum = FreeFile()

    On Error Resume Next
    Open filePath For Binary Access Read Write Lock Read Write As fileNum
    If Err.Number <> 0 Then
        IsFileOpen = True
    End If
    Close fileNum
    On Error GoTo 0

TOP

¦^´_ 3# cowww


³o­Ó¤Ö¤Fµ²§À
End Function

TOP

¦^´_ 4# ­ã´£³¡ªL

«D±`·PÁ­㴣³¡ªL¤j¤jªº´£¿ô

·Q»¡¥i¥H°õ¦æ´N¨S¬Æ»òª`·N¤F

TOP

        ÀR«ä¦Û¦b : ¤£­nÀH¤ß©Ò±ý¡A­nÀH¤ß±Ð¨|¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD