Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good morning,
I have adapted a piece of code I found on the forums to SaveAs (Choose folder for Export) and open the file saved. The problem is the file always defaults to the "Master" ViewRep. Is there a way to have the saved file to open to the defined "Default" ViewRep?
' Get current location of this file Dim ExportPath As String = ThisDoc.Path ' Check that this file has been saved and actually exists on disk If String.IsNullOrEmpty(ExportPath) Then MsgBox("This file has not yet been saved and doesn't exist on disk! - please save it first",64, "Lord iLogic") Return End If ' Define folder browse dialog Dim Dialog = New FolderBrowserDialog() ' Set options for folder browser dialog Dialog.SelectedPath = ExportPath Dialog.ShowNewFolderButton = True Dialog.Description = "Choose Folder for Export..." ' Show dialog box If DialogResult.OK = Dialog.ShowDialog() Then ' User clicked 'ok' on dialog box - capture the export path ExportPath = Dialog.SelectedPath & "\" Else ' User clicked 'cancel' on dialog box - exit Return End If oFileName = iProperties.Value("Project", "Part Number") ' Define the filename of the file to be exported - in this case it is a PDF file extension ExportFilename = oFileName & ".iam" ' Do export operation (using save as) Try ThisDoc.Document.SaveAs(ExportPath & ExportFilename, True) Catch MsgBox("File export failed...", 64, "Lord iLogic") End Try ' Ask user if they want to open (launch) the file we just exported... If MsgBox("File exported: " & _ ExportPath & ExportFilename & vbLf & vbLf & _ "Do you want to open the Assembly Now?", 36, "Lord iLogic - File Exported") = 6 Then ' User says yes...launch exported file ThisDoc.Launch(ExportPath & ExportFilename) End If
Solved! Go to Solution.