popkov
Advanced Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору Код: Sub RemoveAddin_FieldCodes() nResult = VBA.Interaction.MsgBox("Вы уверены, хотите удалить все коды полей типа ADDIN?", vbOKCancel, "Действие необратимо!") If nResult = vbOK Then Dim doc As Document Dim fld As Field Dim ftnt As Footnote Dim endnt As Endnote Dim shp As Shape Dim shp2 As Shape Dim shp3 As Shape Set doc = ActiveDocument ActiveDocument.ActiveWindow.View.ShowFieldCodes = False For Each fld In doc.Fields ' fld.Result.Select If fld.Type = wdFieldAddin Then fld.Unlink End If Next fld For Each ftnt In doc.Footnotes For Each fld In ftnt.Range.Fields ' fld.Result.Select If fld.Type = wdFieldAddin Then fld.Unlink End If Next fld Next ftnt For Each endnt In doc.Endnotes For Each fld In endnt.Range.Fields ' fld.Result.Select If fld.Type = wdFieldAddin Then fld.Unlink End If Next fld Next endnt For Each shp In doc.Shapes If shp.Type = msoTextBox Then For Each fld In shp.TextFrame.TextRange.Fields ' fld.Result.Select If fld.Type = wdFieldAddin Then fld.Unlink End If Next fld End If If shp.Type = msoGroup Then For Each shp2 In shp.GroupItems If shp2.Type = msoTextBox Then For Each fld In shp2.TextFrame.TextRange.Fields ' fld.Result.Select If fld.Type = wdFieldAddin Then fld.Unlink End If Next fld End If Next shp2 End If If shp.Type = msoCanvas Then For Each shp2 In shp.CanvasItems If shp2.Type = msoTextBox Then For Each fld In shp2.TextFrame.TextRange.Fields ' fld.Result.Select If fld.Type = wdFieldAddin Then fld.Unlink End If Next fld End If If shp2.Type = msoGroup Then For Each shp3 In shp2.GroupItems If shp3.Type = msoTextBox Then For Each fld In shp3.TextFrame.TextRange.Fields ' fld.Result.Select If fld.Type = wdFieldAddin Then fld.Unlink End If Next fld End If Next shp3 End If Next shp2 End If Next shp Set fld = Nothing Set ftnt = Nothing Set doc = Nothing Set shp = Nothing Set shp2 = Nothing Set shp3 = Nothing End If End Sub |
| Всего записей: 1835 | Зарегистр. 22-03-2003 | Отправлено: 12:30 05-05-2007 | Исправлено: popkov, 02:29 07-05-2007 |
|