Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic - doesn't close opened document

j.pavlicek
Collaborator

iLogic - doesn't close opened document

j.pavlicek
Collaborator
Collaborator

Hello, I have simple procedure for reading name of title block used in template.

 

Dim oTemplate As DrawingDocument
Dim sTitleBlockName As String
'Opens template
oTemplate = ThisApplication.Documents.Open(ThisDrawing.ResourceFileName, False)
'Name of used title block
sTitleBlockName = oTemplate.ActiveSheet.TitleBlock.Name
'closes tamplate
oTemplate.Close(true)
'Sets actual title block
ActiveSheet.TitleBlock = sTitleBlockName

 

But when I run this code (without any error), and try to create a new drawing, I get msg with text: "The template file is open. Please close it and try again."

inv-warn.png

What is wrong with my code?

 

PS: I tried to comment last line and it works. I think that sTitleBlockName is somehow connected to template file instead to read its Name value.

 

PPS: Moving line with file closing on the end solve my problem, but still. Is possible to use sTitleBlockName with closed template?

 



Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes
Reply
485 Views
2 Replies
Replies (2)

machiel.veldkamp
Collaborator
Collaborator

Try this:

 

oTemplate.Close(false)

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes

j.pavlicek
Collaborator
Collaborator
This means - save template document. I don't want it. See This means - save template document. I don't want it. See http://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-6BBD0D08-7C06-46B1-9E3E-http://help.autode...








Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes