Hello All,
i`m trying to record a macro (because i cannot code it by myself :) ) that unlinks all linked rows. But it seems that if there is a new row (after refreshing the data) the code don`t recognize it.
The steps that i do are :
start recording
select all rows (Ctrl + A)
right click -> un-link
stop recording
Is there a way to avoid missing to un-link rows that were not in the table when i was recording the macro.
Hope i explained it not too bad :)
Thanks for the help in advance !
Hi,
try this code:
Sub unlinkAll()
Dim drs As Visio.DataRecordset
Dim pge As Visio.Page
Dim shp As Visio.Shape
Dim UndoScope As Long
UndoScope = Application.BeginUndoScope("Unlink All")
Set drs = ActiveDocument.DataRecordsets(1)
For Each pge In ActiveDocument.Pages
For Each shp In pge.Shapes
shp.BreakLinkToData drs.ID
Next shp
Next pge
Application.EndUndoScope UndoScope, True
End Sub
The macro recorder also sets the link-status of the properties to false.
I guess that this is not necessary because this status is only required to break the link to single properties when they are changed by hand.
Then this property will not be considered on future refreshes.
This should not be relevant, when the complete shape is unlinked.
Regards,
Thomas
Hi, And thanks for the replay !
This worked perfectly fine and smooth :)