मेरे पास दोहराए गए अनुभाग सामग्री नियंत्रण के अंदर लिपटे सामग्री नियंत्रण के साथ एक शब्द टेम्पलेट है। मुझे आइटम पुनरावर्तक को हटाने के लिए एक बटन बनाने की आवश्यकता है, जैसे कि इसके अतिरिक्त।docx फ़ाइल के मैक्रोज़ में अनुक्रमणिका द्वारा क्रमिक रूप से दोहराना अनुभाग आइटम हटाएं?
मैं दोहराने वाले अनुभाग आइटम को हटाने का तरीका जानने का प्रयास कर रहा हूं। लेकिन इस मामले में - मैं हमेशा अंतिम आइटम हटा देता हूं। लेकिन, मैं उस उपयोगकर्ता को निकालने में सक्षम होना चाहता हूं जिसे उपयोगकर्ता ने चुना है।
Sub delete()
Dim cc As ContentControl
Dim Index
Set cc = ThisDocument.SelectContentControlsByTag("ResolRepeater").Item(1)
With cc
.LockContentControl = False
.LockContents = False
.AllowInsertDeleteSection = True
For Index = 1 To cc.RepeatingSectionItems.Count
If Selection.Range.InRange(cc.RepeatingSectionItems(Index).Range) Or cc.RepeatingSectionItems(Index).Range.InRange(Selection.Range) Then
Exit For
End If
Next Index
'can't delete, get Run-Time Error '5904': "you can not change the range"
cc.RepeatingSectionItems(Index).Range.delete
'this lines always delete last element:
'cc.RepeatingSectionItems(Index).Range.Select
'Selection.Delete
End With
End Sub
मैं किसी भी सवाल का जवाब करने में खुशी होगी ..