I am using this code snippet to open an idw. With this code, the idw has to reside at the same file path as the current document.
>>>>>>>>>>>>>>>>
Sub OpenIDW()
On Error GoTo Oops
Dim oDoc As Document
Set oDoc = ThisApplication.ActiveDocument
Dim sFullFileName As String
sFullFileName = oDoc.FullFileName
Dim sDrawingName As String
sDrawingName = Left(sFullFileName, Len(sFullFileName) - 4) & ".idw"
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.Documents.Open(sDrawingName)
Exit Sub
Oops: MsgBox "IDW File could not be found. FileName of IDW must be the same as this file.", vbInformation End Sub
>>>>>>>>>>>>>>>>>
"What if"... my idw is not at the same location, but under a subfolder instead..... like this
Part file c:\designs\Drawings\Jobxxx
Idw file c:\designs\Drawings\Jobxxx\IDW
I am sure that this can be done by editing the line "sDrawingName = Left(sFullFileName, Len(sFullFileName) - 4) & ".idw" " . Everything I have tried did not work.
Any suggestions?
Thanks
Did you create the folder IDW manually? Inventor might not find it if it doesn't exist
You'll need the Path as well as the File Name to place it there, and ensure your adding the neccessary "\" when creating your path
Hi karthur1,
Here's one approach to appending the file path to include a subfolder:
http://inventortrenches.blogspot.com/2011/07/ilogic-to-save-pdf-files-to-new.html
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
FilePath = Left$(sfullFilename, InStrRev(sfullFilename, "\") - 1)
ipos = InStrRev(sfullFilename, "\")
temp = Right$(sfullFilename, Len(sfullFilename) - ipos)
' Get the base filename by getting everything to
' the left of the last period ".".
BaseFilename = Left$(temp, InStrRev(temp, ".") - 1)
sDrawingName = filepath & "\IDW\" & basefilename & ".idw"
Can't find what you're looking for? Ask the community or share your knowledge.