- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody, I'm using part of a macro which was posted in this forum.
However, when I try to call the procedure “ReplaceFileReference” an error "Byref argument type mismatch" occurs. I know it’s an error related to wrong type variable definition, but I’m not able to fix it, any suggestion?
Sub Replace_idw()
Dim oidwDoc As DrawingDocument
Set oidwDoc = ThisApplication.ActiveDocument
Dim Filename, NewFilename As String
Filename = "C:\Users\uss\Desktop\Example.iam"
NewFilename = "C:\Users\uss\Desktop\Example2.iam"
Call ReplaceFileReference(oidwDoc, Filename, NewFilename)
End Sub
Private Sub ReplaceFileReference(oDoc As Document, oRefToRemove As String, oRefToInclude As String)
Dim oFD As FileDescriptor
For Each oFD In oDoc.File.ReferencedFileDescriptors
If oFD.FullFilename = oRefToRemove Then
oFD.ReplaceReference (oRefToInclude)
End If
Next
End Sub
Solved! Go to Solution.