Copy Sketched Symbol from template IDW to IDW using visual studio

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
This is my first time posting here.
I am attempting to copy sketched symbols from a template .idw to the active .idw. The code snippet (modified to add to the post) I am using is below. I get an error on line "CopySymbol = oSymbol.CopyTo(oDoc)".
Error:
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
I am using inventor 2015. This has just happened and I cannot think of anything that has changed. It runs fine on Inventor 2017 on another machine
Public Shared Function CopySymbol() As Inventor.SketchedSymbolDefinition
Dim inventorApp As Inventor.Application = GetObject(, "Inventor.Application")
Dim oDoc As Inventor.Document = inventorApp.ActiveDocument
Dim oNewDocument As Inventor.DrawingDocument = inventorapp.ActiveDocument
Dim oSourceDocument As Inventor.DrawingDocument = inventorapp.Documents.Open("O:\Drawing 2015.idw")
CopySymbol = Nothing
Dim oSymbol As Inventor.SketchedSymbolDefinition
For Each oSymbol In oSourceDocument.SketchedSymbolDefinitions
CopySymbol = oSymbol.CopyTo(oDoc)
Next
End Function
Thanks in advance
James