Multiple things are wrong here.
Try this for the sub SaveFile(...)
Sub SaveFile(oDoc As Document, NewFileName As String)
If (System.IO.File.Exists(NewFileName)) Then
MsgBox(NewFileName & " already exists. cant save now...")
Return
End If
Try
oDoc.SaveAs(NewFileName, False)
Catch ex As Exception
MsgBox("Something went wrong while saving file: " & NewFileName)
End Try
End Sub
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
Thankyou - it has helped but I'm seeing odd glitches.
I will upload the test files because it's complicated (for me anyway), the idea is:
Overview:
The 'Glitches' are these messages but the parts are still created?
Note the 3 bought out parts in the zipped up attachment have the End of Part marker pulled up to reduce the file size.
The Blocks are to represent small detailed parts (BoP's) possibly not required on a drawing at a 100:1 scale but the code replaces these with a bounding box (size setting in rule) - think it's better to see there's something there rather than omit them.
The same excel file can then be used to swap the 'Full Fat' sub assemblies with the 'Substitute' files without the need for a Level of Detail (hopefully this will help the processing as less files will be retrieved by the data management system).
The simplified sub assemblies appear like this - with blocks replacing the BoP's,
Any help appreciated - I've been chipping away at this for a while & think it's pretty close to working.
Regards
Andrew