會從目前文件清除資料連結圖形的衝突資訊。
注意事項
This Visio object or member is available only to licensed users of Visio Professional 2013.
語法
表情。移除RefreshConflict (ShapeInConflict)
詞 一個回傳 DataRecordset 物件的表達式。
參數
| 名稱 | 必要/選用 | 資料類型 | 描述 |
|---|---|---|---|
| 衝突形體 | 必要 | [IVSHAPE] | 一個連結到在資料記錄集刷新後有衝突的資料的形狀。 |
傳回值
無
註解
如果 ShapeInConflict 實際上沒有衝突,這個方法就不會有任何效果。
如果您選擇不要移除衝突資訊,該資訊會無限期地保存在目前文件中。
範例
這個 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何使用 RemoveRefreshConflict 方法移除衝突。 它會呼叫 GetAllRefreshConflicts 方法,以判斷哪些圖形 (如果有) 在資料錄集重新整理之後發生衝突。 接著它會呼叫 GetMatchingRowsForRefreshConflict 方法,來判斷是哪一列或哪一列的資料記錄集中造成衝突。
它會刷新最近新增的資料記錄集,如果找不到衝突,會在立即視窗中列印「無衝突」。 如果發現衝突,會將每個衝突的形狀傳給 GetMatchingRowsForRefreshConflict 方法,並在同一個視窗中列印產生的列 ID。 接著會將有衝突的形狀傳到 RemoveRefreshConflict 方法以移除衝突。
在執行此巨集前,請確定最近新增的資料記錄集是已連線的 (非 XML 架構) 資料記錄集,而且原始資料來源的連線仍可使用。 然後刪除資料來源中的一列,或做其他更改,導致刷新資料集時產生衝突。
Public Sub RemoveRefreshConflicts_Example()
Dim vsoDataRecordset As Visio.DataRecordset
Dim intRecordsetCount As Integer
Dim intShapeCount As Integer
Dim vsoShapes() As Visio.Shape
Dim intRowCount As Integer
Dim vsoShapeInConflict As Visio.Shape
Dim alngRowIDs() As Long
Dim lngvsoRowID As Long
intRecordsetCount = Visio.ActiveDocument.DataRecordsets.Count
Set vsoDataRecordset = Visio.ActiveDocument.DataRecordsets(intRecordsetCount)
vsoDataRecordset.Refresh
vsoShapes = vsoDataRecordset.GetAllRefreshConflicts
If IsEmpty(vsoShapes) Then
Debug.Print "No conflict"
Else
For intShapeCount = LBound(vsoShapes) To UBound(vsoShapes)
Set vsoShapeInConflict = vsoShapes(intShapeCount)
alngRowIDs = vsoDataRecordset.GetMatchingRowsForRefreshConflict(vsoShapeInConflict)
If IsEmpty(alngRowIDs) Then
Debug.Print "For shape:", vsoShapeInConflict.Name, "Row deleted."
Else
For intRowCount = LBound(alngRowIDs) To UBound(alngRowIDs)
lngvsoRowID = alngRowIDs(intRowCount)
Debug.Print "For shape:", vsoShapeInConflict.Name, "Row ID of row in conflict:", lngvsoRowID
Next intRowCount
End If
Call vsoDataRecordset.RemoveRefreshConflict (vsoShapeInConflict)
Next intShapeCount
End If
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。