اذهب الي المحتوي
أوفيسنا

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

قام بنشر

السلام عليكم
الاخوه الكرام
ارجو التعديل على الكود المرفق والذى يقوم بإرسال نطاق محدد عن طريث الاميل 
من A1 : AK50 من شيت ZAYED
المطلوب اضافه نطاق جديد وهو  (A1 : AK50)  من شيت اسمه CHIKE ZAYED الى النطاق السابق
او اضافه الشيت المسمي   CHIKE ZAYED الى النطاق A1 : AK50 من شيت ZAYED
ارجو ان يكون المطلوب واضح
جزاكم الله خيرا

Sub Mail_Range()
'Working in Excel 2000-2016
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
    Dim Source As Range
    Dim Dest As Workbook
    Dim wb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim OutApp As Object
    Dim OutMail As Object

    Set Source = Nothing
    On Error Resume Next
    
    Set Source = Range("A31:Al53").SpecialCells(xlCellTypeVisible)
    If MsgBox("هل تريد إرسال بدلات المقاول ذايد عطية الى مالية القاهرة ???؟", vbYesNo, "Confirm To Send Email To Cairo") = vbNo Then Exit Sub
      
       
     On Error GoTo 0
    
    If Source Is Nothing Then
        MsgBox "The source is not a range or the sheet is protected, please correct and try again.", vbOKOnly
        Exit Sub
    End If

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    Set wb = ActiveWorkbook
    Set Dest = Workbooks.Add(xlWBATWorksheet)

    Source.copy
    With Dest.Sheets(1)
        .Cells(1).PasteSpecial Paste:=8
        .Cells(1).PasteSpecial Paste:=xlPasteValues
        .Cells(1).PasteSpecial Paste:=xlPasteFormats
        .Cells(1).Select
        Application.CutCopyMode = False
    End With

    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Tarek Zayed Allow" & Format(Date, "mm-yy")

    If Val(Application.Version) < 12 Then
        'You use Excel 97-2003
        FileExtStr = ".xls": FileFormatNum = -4143
    Else
        'You use Excel 2007-2016
        FileExtStr = ".xlsx": FileFormatNum = 51
    End If

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    With Dest
        .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
        On Error Resume Next
        With OutMail
            .To = "a@khalda-eg.com;shehab.mohamed@khalda-eg.com;attia.kamel@khalda-eg.com"
            .CC = "b@khalda-eg.com;attia.kamel@khalda-eg.com"
            .BCC = "c@khalda-eg.com;mohamed.helal@khalda-eg.com"
            .Subject = "بدلات عمالة المقاول زايد عطيه - حقول طارق"
            .Body = "مع تحيات الشئون الاداريه "
            .Attachments.Add Dest.FullName
            'You can add other files also like this
            '.Attachments.Add ("C:\test.txt")
            .Send   'or use .Display
        End With
        On Error GoTo 0
        .Close savechanges:=False
    End With

    Kill TempFilePath & TempFileName & FileExtStr

    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
   End With
    
    MsgBox "تم إرسال الملف الى ماليه القاهرة بنجاج ... شكرا...", 64
End Sub

 

السلام عليكم

الاخوة الكرام

هل الحل ان يكون النطاق بهذاالشكل 

 

    Set Source = Range("A31:Al53").SpecialCells(xlCellTypeVisible)
    Set Source = Range(Sheets(Array("CHIKE ZAYED")).SpecialCells(xlCellTypeVisible))

 

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