- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have a rule that I am working on that bounces off an excel file that generates drawing numbers. It works great except I have an issue when .ipn files are placed in the .idw as the 1st model reference.
I have an if statement that detemines if the model refence is an ipn, and if it is it is needing to change the document to the iam.
SyntaxEditor Code Snippet
'Look at the model file referenced in the open document Dim docFile As Document If ThisDoc.ModelDocument IsNot Nothing Then docFile = ThisDoc.ModelDocument Else MessageBox.Show("This drawing has no model reference", "iLogic") Return End If 'format model file name Dim FNamePos As Long FNamePos = InStrRev(docFile.FullFileName, "\", -1) Dim docFName As String docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)
Dim IPNTest As String IPNTest = Right(docFName, Len(docFName) - InStrRev(docFName, ".")) If IPNTest = "ipn" docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) LendocFName = InStrRev(docFName, ".", -1) docFName = Left(docFName, Len(docFName) - 3) docFName = docFName & "iam" docFile = ThisDoc.docFName End If
I have highlighted the line that I am hung up on. I know that I need to convert the file path from a string to a doc file, but I am unsure how.
Note:
The file structures are all as follows:
IPNTest.iam -- is the iam that I will be creating custom iproperties. I just need to h
IPNTest.idw -- is the idw where the rule is ran from.
IPNtest.ipn -- is idw first model reference.
they are all located in the same folder.
Solved! Go to Solution.