<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Replace title block from template &amp;amp; update date / user in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9805164#M57437</link>
    <description>&lt;P&gt;Yes. Sorry, I didn't elaborate on that point.&amp;nbsp; That's why I put that check in there.&amp;nbsp; You can comment out or delete that message if you want.&amp;nbsp; It's just there to let you know what's going on.&lt;/P&gt;&lt;P&gt;Is it working OK other than that, though?&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2020 16:02:39 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2020-10-15T16:02:39Z</dc:date>
    <item>
      <title>Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9790631#M57426</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I actually have three small problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Recently we changed the title block in our drawing template. So when we create new drawings, this goes well. But when we copy an existing drawing in Vault, you keep the old title block. How can I ensure that this title block is automatically replaced (by the title block from the template) using Ilogic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore, our drawings currently have the '' creation date '' in the title block. This is fine of course, but when we copy a drawing you always keep the old date of the original assembly. How do I make sure this is updated to the last '' save '' date or something like that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore, I would also like to see the property &amp;lt;DESIGNER&amp;gt; updated when a part is copied from the vault database? Is this possible? Now many drawings remain in my own name when new colleagues copy files. This is because I previously worked alone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope someone can help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;BR /&gt;Jeffrey&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 06:31:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9790631#M57426</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-08T06:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9791303#M57427</link>
      <description>&lt;P&gt;If the title block has the same name in the old and new drawings it is quite easy to replace, if they aren't the same it's still easy I just haven't actually done that though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        'Get current drawing
        Dim oDrawDoc As DrawingDocument
        oDrawDoc = ThisApplication.ActiveDocument

        'Get template titleblock
        Dim oDrawTBlockDef As TitleBlockDefinition
        Dim oTemplateTBlockDef As TitleBlockDefinition
        Dim oTemplateBorderDef As BorderDefinition
        Dim oTemplateDoc As DrawingDocument

        oDrawTBlockDef = oDrawDoc.ActiveSheet.TitleBlock.Definition

        If (oDrawTBlockDef.Name = "Titleblock A") Then
            oTemplateDoc = ThisApplication.Documents.Open("Z:\Templates\Drawing A Template.idw", False)
            oTemplateTBlockDef = oTemplateDoc.TitleBlockDefinitions.Item("Titleblock A")
            Call oTemplateTBlockDef.CopyTo(oDrawDoc, True)
        End If
        oTemplateDoc.Close()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; If the currently open drawing has Titleblock A on the current sheet it will replace that title block with the version from the template file referenced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Updating the two properties is a simple matter of using iProperties which you should be able to find many examples of on the forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're planning on doing this as iLogic you'll just need to decide if you want this to run automatically or manually. It'd be possible to have it triggered when you open a document and it would always be up to date, but the creation date and designer would be updated every time also. I personally made an addin with a manual button that updates the title block and an iProperties editor where a user can correct the date and names for a drawing.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 12:26:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9791303#M57427</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2020-10-08T12:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9791304#M57428</link>
      <description>&lt;P&gt;Would this work for you?&lt;/P&gt;&lt;P&gt;(You would have to edit the names of the Template file and the target Border Definition and Title Block Definition in the Template file, to match your situation before it will work properly for you.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then
		MsgBox("This rule '" &amp;amp; iLogicVb.RuleName &amp;amp; "' only works for Drawing Documents. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
		Exit Sub
	End If

	Dim oDDoc As DrawingDocument = ThisDrawing.Document
	ReplaceTBandBorder(oDDoc)
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value = System.IO.File.GetLastWriteTime(oDDoc.FullFileName)
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value = ThisApplication.GeneralOptions.UserName
End Sub

Sub ReplaceTBandBorder(ByRef oDrDoc As DrawingDocument)
	Dim oSheets As Sheets = oDrDoc.Sheets
	Dim oSheet As Sheet
	Dim oTB As TitleBlock
	'Delete TitleBlock &amp;amp; Border from each sheet
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.TitleBlock.Delete
		oSheet.Border.Delete
	Next
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
	'Attempt to delete all TitleBlockDefinitions
	Dim oTBDefs As TitleBlockDefinitions = oDrDoc.TitleBlockDefinitions
	For Each oTBDef As TitleBlockDefinition In oTBDefs
		If oTBDef.IsReferenced = False Then
			oTBDef.Delete
		ElseIf oTBDef.IsReferenced = True Then
			MsgBox("Title Block Def Named '" &amp;amp; oTBDef.Name &amp;amp; "' is referenced, and will not be deleted.",vbOKOnly+vbInformation, "CAN'T BE DELETED")
		End If
	Next
	'Attempt to delete all BorderDefinitions
	Dim oBDefs As BorderDefinitions = oDrDoc.BorderDefinitions
	For Each oBDef As BorderDefinition In oBDefs
		If oBDef.IsReferenced = False Then
			oBDef.Delete
		ElseIf oBDef.IsReferenced = True Then
			MsgBox("Border Def. Named '" &amp;amp; oBDef.Name &amp;amp; "' is referenced, and will not be deleted.",vbOKOnly+vbInformation, "CAN'T BE DELETED")
		End If
	Next
	'Specify the Drawing Template document to copy from
	Dim oTFN As String = "S:\Engineering\Templates\A-Size Standard Drawing.idw"
	Dim oTemplate As DrawingDocument = ThisApplication.Documents.Open(oTFN, False)
	Dim oNewTBDef As TitleBlockDefinition
	Dim oNewBDef As BorderDefinition
	'Copy BorderDefinition from Template to this drawing, and replace if already exists
	Dim oTemBDefs As BorderDefinitions = oTemplate.BorderDefinitions
	For Each oTemBDef As BorderDefinition In oTemBDefs
		If oTemBDef.Name.Contains("A-SIZE LANDSCAPE .25 OFF ALL EDGES") Then
			oNewBDef = oTemBDef.CopyTo(oDrDoc, True)
		End If
	Next
	'Copy TitleBlockDefinition from Template to this drawing, and replace if already exists
	Dim oTemTBDefs As TitleBlockDefinitions = oTemplate.TitleBlockDefinitions
	For Each oTemTBDef As TitleBlockDefinition In oTemTBDefs
		If oTemTBDef.Name = "A-SIZE FULL WIDTH BOTTOM" Then
			oNewTBDef = oTemTBDef.CopyTo(oDrDoc, True)
		End If
	Next
	'Place the new Border &amp;amp; Title Block on all sheets
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.AddBorder(oNewBDef)
		oSheet.AddTitleBlock(oNewTBDef, TitleBlockLocationEnum.kBottomRightPosition)
	Next
	oTemplate.Close(True)
	oTemplate.ReleaseReference
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Oct 2020 12:31:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9791304#M57428</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-08T12:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9797074#M57429</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your Ilogic code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I understand correctly, this code looks at the design properties of the drawing itself and not the Iproperties of the 3D model. If so, that's okay!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think it would be a problem if I change "Creation Time" to "Creation Date", do you?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just don't see anywhere to enter my Title Block name (sorry for my inexperience with Ilogic). In principle, the border does not need to be replaced, but it is allowed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 06:29:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9797074#M57429</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-12T06:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9797691#M57430</link>
      <description>&lt;P&gt;Yes, my code is changing the creation date of the drawing document to match the date of the last time the drawing file was written to.&amp;nbsp; If you need this scenario changed, that would be easy enough.&amp;nbsp; Do you want change the creation date of both the model document and the drawing document, just the model, or just the drawing?&amp;nbsp; Do you want the creation date within the drawing to directly reference that data from the model document's iProperties (or last file write date), instead of from the drawings own creation/last write date?&amp;nbsp; The "Creation Time" iProperty I specified in my last code is the same one shown within the Project tab of the standard iProperties dialog.&amp;nbsp; Is your title block using that property, or is it using a different Custom iProperty?&lt;/P&gt;&lt;P&gt;Just let me know the exact scenario you want and I'll make it happen for you, even if you want this code to effect both the drawing and the model documents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within the last code I posted the following line is where I specified which drawing template file I wanted it to open:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oTFN As String = "S:\Engineering\Templates\A-Size Standard Drawing.idw"&lt;/LI-CODE&gt;&lt;P&gt;You should change that string after the =, to match the path and file name of the drawing template file you want it to reference your newer title block from.&lt;/P&gt;&lt;P&gt;Also, if you don't need to replace the border, you can delete all that code to simplify the solution for you.&lt;/P&gt;&lt;P&gt;Also, in my last posted code, I specified the name of the Title Block Definition I wanted to copy to my new drawing within this If...Then statement:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;	For Each oTemTBDef As TitleBlockDefinition In oTemTBDefs
		If oTemTBDef.Name = "A-SIZE FULL WIDTH BOTTOM" Then
			oNewTBDef = oTemTBDef.CopyTo(oDrDoc, True)
		End If
	Next&lt;/LI-CODE&gt;&lt;P&gt;You will need to change "A-SIZE FULL WIDTH BOTTOM" to the name of the title block definition you want within your drawing template file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an updated code, without the border stuff, and with more iProperty options (some commented out, so you can delete the ones you don't need).&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then
		MsgBox("This rule '" &amp;amp; iLogicVb.RuleName &amp;amp; "' only works for Drawing Documents. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
		Exit Sub
	End If

	Dim oDDoc As DrawingDocument = ThisDrawing.Document
	ReplaceTB(oDDoc)
	Dim oMDoc As Document = ThisDrawing.ModelDocument
'	'drawing only
'	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value = System.IO.File.GetLastWriteTime(oDDoc.FullFileName)
'	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value = ThisApplication.GeneralOptions.UserName
'	'Model only
'	oMDoc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value = System.IO.File.GetLastWriteTime(oMDoc.FullFileName)
'	oMDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value = ThisApplication.GeneralOptions.UserName
	'Model data to drawing only
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value = System.IO.File.GetLastWriteTime(oMDoc.FullFileName)
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value = oMDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value
End Sub

Sub ReplaceTB(ByRef oDrDoc As DrawingDocument)
	Dim oSheets As Sheets = oDrDoc.Sheets
	Dim oSheet As Sheet
	Dim oTB As TitleBlock
	'Delete TitleBlock &amp;amp; Border from each sheet
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.TitleBlock.Delete
	Next
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
	'Attempt to delete all TitleBlockDefinitions
	Dim oTBDefs As TitleBlockDefinitions = oDrDoc.TitleBlockDefinitions
	For Each oTBDef As TitleBlockDefinition In oTBDefs
		If oTBDef.IsReferenced = False Then
			oTBDef.Delete
		ElseIf oTBDef.IsReferenced = True Then
			MsgBox("Title Block Def Named '" &amp;amp; oTBDef.Name &amp;amp; "' is referenced, and will not be deleted.",vbOKOnly+vbInformation, "CAN'T BE DELETED")
		End If
	Next
	'Specify the Drawing Template document to copy from
	Dim oTFN As String = "S:\Engineering\Templates\A-Size Standard Drawing.idw"
	Dim oTemplate As DrawingDocument = ThisApplication.Documents.Open(oTFN, False)
	Dim oNewTBDef As TitleBlockDefinition
	'Copy TitleBlockDefinition from Template to this drawing, and replace if already exists
	Dim oTemTBDefs As TitleBlockDefinitions = oTemplate.TitleBlockDefinitions
	For Each oTemTBDef As TitleBlockDefinition In oTemTBDefs
		If oTemTBDef.Name = "A-SIZE FULL WIDTH BOTTOM" Then
			oNewTBDef = oTemTBDef.CopyTo(oDrDoc, True)
		End If
	Next
	'Place the new Border &amp;amp; Title Block on all sheets
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.AddTitleBlock(oNewTBDef, TitleBlockLocationEnum.kBottomRightPosition)
	Next
	oTemplate.Close(True)
	oTemplate.ReleaseReference
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
End Sub&lt;/LI-CODE&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click 'LIKE' &lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;Vote For &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":light_bulb:"&gt;💡&lt;/span&gt;&lt;/SPAN&gt;&lt;/A&gt;and Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.autodesk.com/view/INVNTOR/2020/ENU/" target="_blank"&gt;Inventor 2020 Help &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-forum/bd-p/78/" target="_blank"&gt;Inventor Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-customization/bd-p/120/" target="_blank"&gt;Inventor Customization Forum &lt;/A&gt;| &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/idb-p/v1232/" target="_blank"&gt;Inventor Ideas Forum &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2020 12:43:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9797691#M57430</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-12T12:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9799227#M57431</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like the following fields in drawing Iproperties to be updated.&lt;/P&gt;&lt;P&gt;- Designer&lt;BR /&gt;- Creation Date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've removed the parts I don't need from your code (see code below).&lt;/P&gt;&lt;P&gt;However, when I test the code I get the following message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="picture.PNG" style="width: 418px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/830565iB7C50A50FB8DA368/image-size/large?v=v2&amp;amp;px=999" role="button" title="picture.PNG" alt="picture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I click further, I get the message below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.PNG" style="width: 540px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/830568i896DBA6A5950CC61/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.PNG" alt="error.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After this error message, the title block has strangely been removed ...&lt;/P&gt;&lt;P&gt;The properties have not yet been updated either, but this is probably because the code is not running completely.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;iLogic code with drawing part only&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then
		MsgBox("This rule '" &amp;amp; iLogicVb.RuleName &amp;amp; "' only works for Drawing Documents. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
		Exit Sub
	End If

	Dim oDDoc As DrawingDocument = ThisDrawing.Document
	ReplaceTB(oDDoc)
	Dim oMDoc As Document = ThisDrawing.ModelDocument
'	'drawing only
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value = System.IO.File.GetLastWriteTime(oDDoc.FullFileName)
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value = ThisApplication.GeneralOptions.UserName
End Sub

Sub ReplaceTB(ByRef oDrDoc As DrawingDocument)
	Dim oSheets As Sheets = oDrDoc.Sheets
	Dim oSheet As Sheet
	Dim oTB As TitleBlock
	'Delete TitleBlock &amp;amp; Border from each sheet
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.TitleBlock.Delete
	Next
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
	'Attempt to delete all TitleBlockDefinitions
	Dim oTBDefs As TitleBlockDefinitions = oDrDoc.TitleBlockDefinitions
	For Each oTBDef As TitleBlockDefinition In oTBDefs
		If oTBDef.IsReferenced = False Then
			oTBDef.Delete
		ElseIf oTBDef.IsReferenced = True Then
			MsgBox("Title Block Def Named '" &amp;amp; oTBDef.Name &amp;amp; "' is referenced, and will not be deleted.",vbOKOnly+vbInformation, "CAN'T BE DELETED")
		End If
	Next
	'Specify the Drawing Template document to copy from
	Dim oTFN As String = "C:\WF\System Configurations\2020\Inventor\Templates"
	Dim oTemplate As DrawingDocument = ThisApplication.Documents.Open(oTFN, False)
	Dim oNewTBDef As TitleBlockDefinition
	'Copy TitleBlockDefinition from Template to this drawing, and replace if already exists
	Dim oTemTBDefs As TitleBlockDefinitions = oTemplate.TitleBlockDefinitions
	For Each oTemTBDef As TitleBlockDefinition In oTemTBDefs
		If oTemTBDef.Name = "Notech" Then
			oNewTBDef = oTemTBDef.CopyTo(oDrDoc, True)
		End If
	Next
	'Place the new Border &amp;amp; Title Block on all sheets
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.AddTitleBlock(oNewTBDef, TitleBlockLocationEnum.kBottomRightPosition)
	Next
	oTemplate.Close(True)
	oTemplate.ReleaseReference
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully you can help me with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 06:18:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9799227#M57431</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-13T06:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9800563#M57432</link>
      <description>&lt;P&gt;I think I see where the problem is within your last posted code.&lt;/P&gt;&lt;P&gt;The following line:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oTFN As String = "C:\WF\System Configurations\2020\Inventor\Templates"&lt;/LI-CODE&gt;&lt;P&gt;is not complete.&amp;nbsp; It isn't specifying a drawing template file.&amp;nbsp; See my earlier example code.&amp;nbsp; It looks like you need to add some more to the end of that string.&amp;nbsp; Maybe something like this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oTFN As String = "C:\WF\System Configurations\2020\Inventor\Templates\Standard Drawing.idw"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;If you fix this line, it will likely make the rule run OK.&amp;nbsp; But if you want, you could add a couple of Try...Catch...End Try statements in there, to help avoid potential errors.&amp;nbsp; Or even enclose most if not all of the code within an InteractionEvent, so it is all seen as one action, and then the whole thing can be undone in one click.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2020 16:45:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9800563#M57432</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-13T16:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9801505#M57433</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had indeed not entered the name of the template correctly.&lt;/P&gt;&lt;P&gt;After I have adjusted this the following happens:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After starting the code I first get the message below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 418px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831056i3A16D49631F3C3B6/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I continue, the title block will be replaced!&lt;BR /&gt;But then I receive the following error ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 540px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831057i89BCB7639243FE67/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 821px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831058iEE7C8CA1243A9CB4/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I continue the designer will be updated but the date will not change unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 06:05:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9801505#M57433</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-14T06:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9801588#M57434</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sorry for the double reply but the Autodesk forum gave all kinds of errors while posting.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had indeed forgotten to adjust that properly.&lt;/P&gt;&lt;P&gt;However, the message below continues to emerge.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 418px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831080iA3525A4436D1EBE5/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I continue, the title block will be replaced!&lt;BR /&gt;Then the following message comes up ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 540px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831082i697773A4FA3E8734/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 821px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/831081i4C63FDF7DED9503E/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the end the '' Designer '' has been updated but the date unfortunately not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 07:02:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9801588#M57434</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-14T07:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9802308#M57435</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp; Well, the error message seems to be suggesting that it doesn't like the following line in the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oTemplate.ReleaseReference&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If this line is causing the error, you can just delete it.&amp;nbsp; It is a memory clean-up tool, that might not even be necessary in this situation.&amp;nbsp; That "ReleaseReference" is used to release Inventor's reference to a document that has been opened invisibly (in the background), which frees up that system memory, and releases any sort of "write lock" that your system might have put on that file as a result of Inventor actively referencing it.&lt;/P&gt;&lt;P&gt;However, the oTemplate.Close line could very well be all we need in this short code.&lt;/P&gt;&lt;P&gt;You can try commenting that line out, then see what happens, and if that doesn't work, try commenting the Close line instead, and see if that works.&amp;nbsp; It likely just doesn't like both of them at the same time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; There is another line I often use in larger codes, where I may be opening a large number of documents invisibly, that is also designed to clean-up all these invisibly opened documents, that are no longer being referenced, or needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;ThisApplication.Documents.CloseAll(True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The True is important in this line, because that's what tells it to only close all the unreferenced documents, instead of all regular visible documents that are open.&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click 'LIKE' &lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Oct 2020 13:13:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9802308#M57435</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-14T13:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9804970#M57436</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tested both options.&lt;BR /&gt;The notifications ''Can't be deleted'' still keeps popping up.&lt;/P&gt;&lt;P&gt;The error code ''HRESULT...'' no longer appears so that's good!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have found the link below via google ..&lt;/P&gt;&lt;P&gt;Maybe this has something to do with it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://adndevblog.typepad.com/manufacturing/2012/06/titleblockdefinition-cannot-be-deleted-even-though-all-the-referenced-titleblocks-are-deleted.html" target="_blank" rel="noopener"&gt;https://adndevblog.typepad.com/manufacturing/2012/06/titleblockdefinition-cannot-be-deleted-even-though-all-the-referenced-titleblocks-are-deleted.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 14:47:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9804970#M57436</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-15T14:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9805164#M57437</link>
      <description>&lt;P&gt;Yes. Sorry, I didn't elaborate on that point.&amp;nbsp; That's why I put that check in there.&amp;nbsp; You can comment out or delete that message if you want.&amp;nbsp; It's just there to let you know what's going on.&lt;/P&gt;&lt;P&gt;Is it working OK other than that, though?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 16:02:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9805164#M57437</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-15T16:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9806406#M57438</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Works perfectly!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;</description>
      <pubDate>Fri, 16 Oct 2020 06:12:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9806406#M57438</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-16T06:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810427#M57439</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today I found out there is another error popping up. This only happens when saving a new drawing (so not a copy of an existing drawing).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea how this can be solved?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 827px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/833062iE2431FD0672B69A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 821px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/833063i473A4C9CEBE29CF0/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kinds regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 11:19:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810427#M57439</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-19T11:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810478#M57440</link>
      <description>&lt;P&gt;The error message indicates it is having trouble accessing a PartsList object.&amp;nbsp; Perhaps your code needs to check to see if the PartsLists.Count &amp;gt; 0 (or similar), before trying to access the individual PartsList.&amp;nbsp; Or if it is sometimes possible the target PartsList may not exists yet, and you want the code to create it, you could use a Try...Catch...End Try block of code, where you try to access the PartsList in the Try portion, and if that fails, you can use the Catch portion to create it.&amp;nbsp; Often times you can avoid using the Try...Catch...End Try block by using a series of If...Then and/or Loop blocks, but that's up to your coding style.&amp;nbsp; It would be difficult to be more specific with a solution without seeing the underlying code and understanding what files may be open at the time, and what objects may or may not exist already within those documents.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 11:55:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810478#M57440</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-19T11:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810578#M57441</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, I added the wrong images.&lt;BR /&gt;I had already solved this problem myself.&lt;/P&gt;&lt;P&gt;This concerns the error message below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 536px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/833085i600498DFB8BD9C0C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 699px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/833086i90F34957213321DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible that the title block will only be replaced on drawings older than a certain date (before it is updated to the last writing date of course)? Because in principle it is nonsense that the title block is replaced with a new drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 12:43:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810578#M57441</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-19T12:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810866#M57442</link>
      <description>&lt;P&gt;Ah...I see it now.&amp;nbsp; I didn't account for the conversion from a DataTime object to either a Date object or a String object, that only includes the date data without the time data.&amp;nbsp; My mistake.&lt;/P&gt;&lt;P&gt;Here is some educational example code you can play with that should clear things up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dim oDoc As Document = ThisDoc.Document
Dim oLastWriteDateAndTime As DateTime = IO.File.GetLastWriteTime(oDoc.FullFileName)
Dim oLastWriteDate As Date = IO.File.GetLastWriteTime(oDoc.FullFileName).Date
Dim oLastWriteDateString As String = IO.File.GetLastWriteTime(oDoc.FullFileName).ToShortDateString
MsgBox("oLastWriteDateAndTime As DateTime = " &amp;amp; oLastWriteDateAndTime)
MsgBox("oLastWriteDate As Date = " &amp;amp; oLastWriteDate)
MsgBox("oLastWriteDateString As String = " &amp;amp; oLastWriteDateString)

'Set the oldest allowable date to leave the title block alone.
Dim oOldDate As Date = DateValue("03/05/2016")  ' this will often accept many formats that can be understood as representing a date.
Dim oFutureDate As Date = DateValue("12/29/2020")

'Comparing dates
MsgBox("Older date compared to newer date = " &amp;amp; oLastWriteDate.CompareTo(oOldDate)) 'should equal 1, because oLastWriteDate is later than oOldDate
MsgBox("When dates are equal = " &amp;amp; Today.CompareTo(Today)) 'should equal 0, because they are equal (Today is a DateAndTime property)
MsgBox("Older or current date compared to future date = " &amp;amp; oLastWriteDate.CompareTo(oFutureDate)) 'should equal -1, because oLastWriteDate is earlier than oFutureDate&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So yes.&amp;nbsp; You could set your code up do only replace the title block if the Creation Date is older than a certain specified date.&lt;/P&gt;&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&gt;&lt;STRONG&gt;ACCEPT SOLUTION&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click 'LIKE' &lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/SPAN&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 14:35:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9810866#M57442</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-19T14:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9813038#M57443</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;That's how the code eventually turned out.&lt;BR /&gt;Everything works so that's great.&lt;/P&gt;&lt;P&gt;However, there is one more thing that I do not understand... When I right click on '' open newest drawing '' in Inventor, I get an error message (see image below). I only get this message once per drawing. When I try to retrieve the drawing again later, this error message does not appear.&lt;/P&gt;&lt;P&gt;When I click on '' open drawing from vault '' in the vault browser add-in, I don't get an error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is strange, isn't it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Sub Main
	If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then
		MsgBox("This rule '" &amp;amp; iLogicVb.RuleName &amp;amp; "' only works for Drawing Documents. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
		Exit Sub
	End If

	Dim oDDoc As DrawingDocument = ThisDrawing.Document
	
	
	
	Dim oDoc As Document = ThisDoc.Document

Dim oLastCreationDate as Date = oDDoc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").value
'msgbox(oLastCreationDate)
'Set the oldest allowable date to leave the title block alone.
Dim oOldDate As Date = DateValue("19/10/2020")  ' this will often accept many formats that can be understood as representing a date.
Dim lValue as string = Format(Now, "dd/MM/yy")

'msgbox(lvalue)

'Comparing dates
'MsgBox("Older date compared to newer date = " &amp;amp; oLastCreationDate.CompareTo(oOldDate)) 'should equal 1, because oLastCreationDate is later than oOldDate


if oLastCreationDate.CompareTo(oOldDate) = -1 then

	ReplaceTB(oDDoc)
	Dim oMDoc As Document = ThisDrawing.ModelDocument
'	'drawing only
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value = lValue
	oDDoc.PropertySets.Item("Design Tracking Properties").Item("Designer").Value = ThisApplication.GeneralOptions.UserName
end if


end Sub

function ReplaceTB(ByRef oDrDoc As DrawingDocument)
	Dim oSheets As Sheets = oDrDoc.Sheets
	Dim oSheet As Sheet
	Dim oTB As TitleBlock
	'Delete TitleBlock &amp;amp; Border from each sheet
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.TitleBlock.Delete
	Next
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
	'Attempt to delete all TitleBlockDefinitions
	Dim oTBDefs As TitleBlockDefinitions = oDrDoc.TitleBlockDefinitions
	For Each oTBDef As TitleBlockDefinition In oTBDefs
		If oTBDef.IsReferenced = False Then
			oTBDef.Delete
		'ElseIf oTBDef.IsReferenced = True Then
			'MsgBox("Title Block Def Named '" &amp;amp; oTBDef.Name &amp;amp; "' is referenced, and will not be deleted.",vbOKOnly+vbInformation, "CAN'T BE DELETED")
		End If
	Next
	'Specify the Drawing Template document to copy from
	Dim oTFN As String = "C:\WF\System Configurations\2020\Inventor\Templates\Template Notech.idw"
	Dim oTemplate As DrawingDocument = ThisApplication.Documents.Open(oTFN, False)
	Dim oNewTBDef As TitleBlockDefinition
	'Copy TitleBlockDefinition from Template to this drawing, and replace if already exists
	Dim oTemTBDefs As TitleBlockDefinitions = oTemplate.TitleBlockDefinitions
	For Each oTemTBDef As TitleBlockDefinition In oTemTBDefs
		If oTemTBDef.Name = "Notech" Then
			oNewTBDef = oTemTBDef.CopyTo(oDrDoc, True)
		End If
	Next
	'Place the new Border &amp;amp; Title Block on all sheets
	For Each oSheet In oSheets
		oSheet.Activate
		oSheet.AddTitleBlock(oNewTBDef, TitleBlockLocationEnum.kBottomRightPosition)
	Next
	oTemplate.Close(True)
	'oTemplate.ReleaseReference
	'Re-Activate the first sheet again
	oSheets.Item(1).Activate
End function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jeffrey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 13:43:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9813038#M57443</guid>
      <dc:creator>j.wolbers-NoTech</dc:creator>
      <dc:date>2020-10-20T13:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9813164#M57444</link>
      <description>&lt;P&gt;I'm not sure about that error.&amp;nbsp; I'm not familiar with the "open newest drawing" option.&amp;nbsp; Is this related to Vault?&amp;nbsp; I'm likely not going to be much help when relating to Vault functionality or behavior though, because our company is not currently using it, so I'm just not familiar enough with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only thing that comes to mind is that sometimes the actions you make happen by code, aren't always recorded the same way as when you do them manually.&amp;nbsp; At least not as far as the Undo and Redo system is concerned.&amp;nbsp; This is more evident when using other forms of code execution, such as Batch files, rather than with iLogic.&amp;nbsp; From what I've observed while using ilogic &amp;amp; VBA over the years, the Undo/Redo system seems to record the actions as normal (similar to manual actions).&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 14:29:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9813164#M57444</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2020-10-20T14:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: Replace title block from template &amp; update date / user</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9914636#M57447</link>
      <description>&lt;P&gt;Deleted this, seemed to do the trick, don't know why though:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;oTemplate.Close(True)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 04 Dec 2020 07:37:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replace-title-block-from-template-amp-update-date-user/m-p/9914636#M57447</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-12-04T07:37:20Z</dc:date>
    </item>
  </channel>
</rss>

