Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub RemoveGluePointsAndConnections()
- Dim pg As Page
- Dim shp As Shape
- Dim secIndex As Integer
- Dim row As Integer
- Dim cellX As Cell
- Dim cellY As Cell
- Dim i As Integer
- ' Перебираем все страницы в документе
- For Each pg In ActiveDocument.Pages
- ' Перебираем все фигуры на странице
- For Each shp In pg.Shapes
- ' Удаление всех Connection Points (Точек соединения)
- If shp.SectionExists(visSectionConnectionPts, False) Then
- For i = shp.RowCount(visSectionConnectionPts) - 1 To 0 Step -1
- shp.DeleteRow visSectionConnectionPts, i
- Next i
- End If
- ' Проверяем стандартные секции, такие как Geometry, которые могут содержать PAR(PNT(...))
- For secIndex = visSectionObject To visSectionFirstComponent - 1
- If shp.SectionExists(secIndex, False) Then
- ' Перебираем строки в секции
- For row = 0 To shp.RowCount(secIndex) - 1
- ' Обрабатываем ячейки X и Y
- On Error Resume Next ' Пропускаем возможные ошибки
- Set cellX = shp.CellsSRC(secIndex, row, visX)
- Set cellY = shp.CellsSRC(secIndex, row, visY)
- ' Если формула содержит PAR(PNT(...)), заменяем её на абсолютное значение
- If InStr(cellX.FormulaU, "PAR(PNT") > 0 Then
- cellX.ResultIU = cellX.ResultIU
- End If
- If InStr(cellY.FormulaU, "PAR(PNT") > 0 Then
- cellY.ResultIU = cellY.ResultIU
- End If
- On Error GoTo 0 ' Возвращаем нормальную обработку ошибок
- Next row
- End If
- Next secIndex
- Next shp
- Next pg
- MsgBox "Все точки соединения удалены, формулы с PAR(PNT(...)) заменены на абсолютные значения."
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment