- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi!
I have a working code, but I’d like to make a change because I don’t like how it functions.
Basically, what I want to do is: open the IDW template, get the TitleBlockDefinition of a specific title block, and copy it into another file.
So far, so good.
The problem is that the variable I create to obtain the TitleBlockDefinition remains "active" as long as the template stays open (and I don’t understand why... once I’ve retrieved the content, shouldn’t I be done with it and be detached from the source file?). If I close the source file, the variable loses this information, and I can no longer copy the TitleBlockDefinition into other files.
Since I have several files to loop through, I’d like to avoid keeping the template open for too long.
I’m attaching simplified versions of the code to clarify the issue. The first one works, while the second one (which I’d like to implement) doesn’t.
Can you help me understand why?
Thank you very much.
' WORKING
Dim oTempDrawing As DrawingDocument = ThisApplication.Documents.Open("myTemplatePath", False)
Dim oTitleBlockDef As TitleBlockDefinition = oTempDrawing.TitleBlockDefinitions.Item("MyTitleBlockName")
For Each idwfile [..]
' Doing My things
' Copying TitleBlockDefinition
Next
oTempDrawing.Close
' NOT WORKING
Dim oTempDrawing As DrawingDocument = ThisApplication.Documents.Open("MyTemplatePath", False)
Dim oTitleBlockDef As TitleBlockDefinition = oTempDrawing.TitleBlockDefinitions.Item("MyTitleBlockName")
oTempDrawing.Close
For Each idwfile [..]
' Doing My things
' Copying TitleBlockDefinition
Next
Solved! Go to Solution.