اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

الردود الموصى بها

قام بنشر

 

كود لتمكين وحدات المكرو اوتوماتيكي

Option Explicit


Private Sub Workbook_BeforeClose(Cancel As Boolean)
kh_wVisible False
ThisWorkbook.Close Not CBool(ThisWorkbook.Saved)
End Sub

Private Sub Workbook_Open()
kh_AhlnWShln
End Sub

 

كود لح>ف الملف


Option Explicit

Private Const MAX_USES As Long = 1

Private Sub Workbook_Open()


    Dim lNumberOfUses As Long
    
    On Error Resume Next
    
    lNumberOfUses = Evaluate("NumberOfUses")
    
    If Err.Number = 13 Then
        Me.Names.Add "NumberOfUses", 1, False
        Me.Save
        Exit Sub
    End If
    
    Me.Names.Add "NumberOfUses", Evaluate("NumberOfUses") + 1, False
    Me.Save
    If Evaluate("NumberOfUses") > MAX_USES Then Kill_Myself


End Sub


Private Sub Kill_Myself()
    
    With Me
        .Saved = True
        .ChangeFileAccess xlReadOnly
        Kill .FullName
        .Close False
    End With
    
End Sub

 

حاورت الدمج بينهما و لم اتمكن من ذلك ممكن الحل من الخبراء ان امكن   مهما كان الملف و لو شيت فارغة لا تفتح الا بالكود مع ح>فها بعد دقيقتان

شكرا للجميع

 
  •  

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information