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

تعديل لكود ياخذ الصورة قص وليس نسخ


إذهب إلى أفضل إجابة Solved by محمد التميمي,

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

السلام عليكم

لدي في النموذج رز امر يحتوي على كود ليستعرض الكومبيوتر وياخذ الصورة نسخ ويحفضها في Pictures برقم السجل . جيد جداً

المطلوب 

تعديل على الكود لياخذ الصورة قص وليس نسخ 

لانه يوجد ملف فيه صور كثيرة وكلما اخذ الصور قص وليس نسخ تتناقص الصور تدريجيا 

بوركتم وجزاكم الله خير جزاء المحسنين

New.rar

رابط هذا التعليق
شارك

ضع هذا الكود ....

On Error GoTo err:

   ' Requires reference to Microsoft Office 15.0 Object Library.
Dim fso As Object
Set fso = CreateObject("scripting.filesystemobject")
   Dim fDialog As Office.FileDialog
   Dim varFile As Variant
    Dim destpath As Variant
   ' Clear listbox contents.
   Me.PicPath2 = ""

   ' Set up the File Dialog.
   Set fDialog = Application.FileDialog(msoFileDialogFilePicker)

   With fDialog

      ' Allow user to make multiple selections in dialog box
      .AllowMultiSelect = False

      ' Set the title of the dialog box.
      .title = "Please select one image"

      ' Clear out the current filters, and add our own.
      .Filters.Clear
      .Filters.Add "png image", "*.jpg"
      .Filters.Add "jpg image", "*.bmp"
      .Filters.Add "jpeg image", "*.png"
      .Filters.Add "jpg image", "*.jpeg"
      .Filters.Add "All Files", "*.*"

      ' Show the dialog box. If the .Show method returns True, the
      ' user picked at least one file. If the .Show method returns
      ' False, the user clicked Cancel.
      If .Show = True Then

         'Loop through each file selected and add it to our list box.
         For Each varFile In .SelectedItems
         
       
        destpath = Application.CurrentProject.Path & "\" & "Pictures" & "\" & Me.Key & "." & Right$(varFile, Len(varFile) - InStrRev(varFile, "."))
            FileCopy varFile, destpath
            Kill (varFile)
            Me.PicPath2 = destpath
            Me.Refresh
            
         Next

      Else
         MsgBox "لقد قمت بالنقر فوق إلغاء الأمر في مربع حوار الملف."
      End If
   End With
   Exit Sub
err:
   MsgBox err.Description & " " & err.Number

تم اضافة هذا الجزء 

Kill (varFile)

 

  • Like 4
رابط هذا التعليق
شارك

  • أفضل إجابة
8 دقائق مضت, kanory said:

ضع هذا الكود ....

 

 

شكرا استاذي على المرور بارك الله بك الكود يعمل بامتياز كان الخطأ من عندي

تم تعديل بواسطه محمد التميمي
رابط هذا التعليق
شارك

10 minutes ago, kanory said:

ضع هذا الكود ....

On Error GoTo err:

   ' Requires reference to Microsoft Office 15.0 Object Library.
Dim fso As Object
Set fso = CreateObject("scripting.filesystemobject")
   Dim fDialog As Office.FileDialog
   Dim varFile As Variant
    Dim destpath As Variant
   ' Clear listbox contents.
   Me.PicPath2 = ""

   ' Set up the File Dialog.
   Set fDialog = Application.FileDialog(msoFileDialogFilePicker)

   With fDialog

      ' Allow user to make multiple selections in dialog box
      .AllowMultiSelect = False

      ' Set the title of the dialog box.
      .title = "Please select one image"

      ' Clear out the current filters, and add our own.
      .Filters.Clear
      .Filters.Add "png image", "*.jpg"
      .Filters.Add "jpg image", "*.bmp"
      .Filters.Add "jpeg image", "*.png"
      .Filters.Add "jpg image", "*.jpeg"
      .Filters.Add "All Files", "*.*"

      ' Show the dialog box. If the .Show method returns True, the
      ' user picked at least one file. If the .Show method returns
      ' False, the user clicked Cancel.
      If .Show = True Then

         'Loop through each file selected and add it to our list box.
         For Each varFile In .SelectedItems
         
       
        destpath = Application.CurrentProject.Path & "\" & "Pictures" & "\" & Me.Key & "." & Right$(varFile, Len(varFile) - InStrRev(varFile, "."))
            FileCopy varFile, destpath
            Kill (varFile)
            Me.PicPath2 = destpath
            Me.Refresh
            
         Next

      Else
         MsgBox "لقد قمت بالنقر فوق إلغاء الأمر في مربع حوار الملف."
      End If
   End With
   Exit Sub
err:
   MsgBox err.Description & " " & err.Number

تم اضافة هذا الجزء 

Kill (varFile)

 

هل تقصد استاذ ...اضافة هذا الحقل فقط ؟

Kill (varFile)

تم تعديل بواسطه Eng.Qassim
رابط هذا التعليق
شارك

5 دقائق مضت, Eng.Qassim said:

هل تقصد استاذ ...اضافة هذا الحقل فقط ؟

 

Kill (varFile)

 

اسف استاذي كنت اعمل على غير برنامج وسطح المكتب فوضى 

تم تعديل بواسطه محمد التميمي
رابط هذا التعليق
شارك

1 minute ago, محمد التميمي said:

اسف استاذي كنت اعمل على غير برنامج وسطح المكتب فوضى الكود يعمل بنجاح بار الله بجهودك وزاد الله من ميزان حسناتك

الشكر لاستاذ kanory وليس لي

رابط هذا التعليق
شارك

19 دقائق مضت, kanory said:

ضع هذا الكود ....

تم اضافة هذا الجزء 

 

شكرأ شكرأ اخي واستاذي kanory تم تجربة الكود عدة مرات ويعمل بامتياز اسف على تاخري بالرد اعمل على برنامج آخر وسطح المكتب فوضى

بارك الله بك اخي الفاضل وجعله الله في ميزان حسناتك

رابط هذا التعليق
شارك

7 minutes ago, محمد التميمي said:

شكرأ شكرأ اخي واستاذي kanory تم تجربة الكود عدة مرات ويعمل بامتياز اسف على تاخري بالرد اعمل على برنامج آخر وسطح المكتب فوضى

بارك الله بك اخي الفاضل وجعله الله في ميزان حسناتك

شكرا لك استاذ محمد التميمي على سؤالك فقد اضاف لنا معلومة من الاستاذ

kanory

رابط هذا التعليق
شارك

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