Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
frederic.vandenplas
in reply to: Jef_E

@Jef_E i had the same issues, and i actually recreated the manual labour in code

I use this tool a lot to avoid the workaround

 

Sub ReplaceView()
 
Dim oDoc, oDocTemp As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Set oDocTemp = ThisApplication.Documents.Add(kDrawingDocumentObject)

Dim oDrawingView, oDrawingViewTemp As DrawingView
Set oDrawingView = oDoc.SelectSet.Item(1)
Dim strDrawingViewName As String
strDrawingViewName = oDrawingView.Name

Call oDrawingView.CopyTo(oDocTemp.ActiveSheet)
oDrawingView.Delete

oDocTemp.Activate
Set oDrawingViewTemp = oDocTemp.ActiveSheet.DrawingViews(1)

Dim fd As FileDialog
Call ThisApplication.CreateFileDialog(fd)

Dim strFileName As String
fd.ShowOpen
strFileName = fd.FileName

Call oDrawingViewTemp.ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(strFileName)
oDocTemp.Update2
Call oDrawingViewTemp.CopyTo(oDoc.ActiveSheet)

Call oDocTemp.Close(True)
Call oDoc.Activate

oDoc.Update2
 
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"