04-22-2021
08:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-22-2021
08:48 PM
I think this should find your file:
Sub Main
Dim MyDrawDoc As DrawingDocument = ThisDoc.Document
Dim mySavePath As String = GetPath(MyDrawDoc, "\Title Block Information.xlsx")
MessageBox.Show(mySavePath, "Result")
End Sub
Private Function GetPath(aDoc As Document, searchName As String) As String
Dim Result As String = "Excel File not found"
Dim sFullDocumentPath As String = aDoc.FullFileName
Dim SearchFolder As String = Left(sFullDocumentPath, sFullDocumentPath.LastIndexOf("\"))
CheckFolder :
Logger.Trace(SearchFolder)
If System.IO.File.Exists(SearchFolder & searchName)
Result = SearchFolder & searchName
Return Result
Else If SearchFolder.Count(Function(c As Char) c = "\")>0
SearchFolder = Left(SearchFolder, SearchFolder.LastIndexOf("\"))
GoTo CheckFolder
End If
Return Result
End Function
Let me know if you have any questions, or if this is not working as intended