19-03-2019, 09:50 AM (آخر تعديل لهذه المشاركة: 25-03-2019, 03:00 PM بواسطة محمد عبد العزيز.)
السلام عليكم
لديا جدول بالاكسال بالمرفقات اريد اضافة زر مرتبط بماكرو بحيث عند الضغط علية ينشا لي ملف نصي وفق الملف الذي هو بالمرفقات مع امكانية تسمية هذ الملف النصي
اذا امكن صيغة هذا الماكرو
وكيف يمكن عمل ذلك ببرمجة الدلفي
25-03-2019, 02:53 PM (آخر تعديل لهذه المشاركة: 25-03-2019, 03:01 PM بواسطة محمد عبد العزيز.)
السلام عليكم
رغم عدم وجود مشاركات في موضوعي هذا بعد بحث و تجريب توصلت
لهذا هو الماكرو بالنسبة لبرمجة البازيك الذي يصلح مع الاكسال و الكل يغير حسب الخلايا المناسبة
كود :
Sub clique()
If Cells(11, 6) <> 0 Then
MsgBox ("Balance non Equilibrer ! ")
GoTo fin1
End If
Dim chemin As String
Dim derligne As Long
Dim tableau() As Variant
Dim ligne, lignerang As Long
Dim nabil As Object
chemin = ActiveWorkbook.Path
Set nabil = CreateObject("Scripting.FileSystemObject")
derligne = Cells(6, 16)
ligne = 8
lignerang = 35
Do While ligne <= 11000
ReDim Preserve tableau(ligne)
'tableau(ligne) = Range("AB" & lignerang)
tableau(ligne) = Cells(ligne, 28) & Cells(ligne, 29) & Cells(ligne, 30) & Cells(ligne, 31) & Cells(ligne, 32) & Cells(ligne, 33) & Cells(ligne, 3) & Cells(ligne, 35)
ligne = ligne + 1
lignerang = lignerang + 1
Loop
Close
file = chemin & "\text\" & "RLQ_" & Cells(5, 8) & ".txt"
If (nabil.FileExists(file)) Then
Kill file
End If
Close
ligne = 1
f = 1
Do While f = 1
If Cells(ligne + 8, 28) = "FIN" Then
f = 0
GoTo ST
End If
If Cells(ligne, 28) <> "" Then
Open file For Append As #ligne
Print #ligne, tableau(ligne)
Close
End If
ligne = ligne + 1
ST:
Loop
Close
MsgBox ("Fichier " & "\text\" & "RLQ_" & Cells(5, 8) & ".txt")
Dim MonApplication As Object
Set MonApplication = CreateObject("Shell.Application")
MonApplication.Open (file)
fin1:
End Sub