<?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: Error message: Object variable or With block variable not set in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8507830#M92968</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;, the .Add command returns the object.&amp;nbsp; So his modification works fine as a one liner, and doesn't require the second line to get the item.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;prop = &lt;SPAN&gt;customPropertySet.Add("TEST", oCustiProperties_Array.Item(i))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jan 2019 16:10:00 GMT</pubDate>
    <dc:creator>JamieVJohnson2</dc:creator>
    <dc:date>2019-01-08T16:10:00Z</dc:date>
    <item>
      <title>Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8504200#M92907</link>
      <description>&lt;P&gt;When I run my rule in the drawing document, I get the above error message. Request help.&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="Message.png" style="width: 879px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/587928iC47E91D91C18E4D3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Message.png" alt="Message.png" /&gt;&lt;/span&gt;Inventor Professional 2019&lt;/P&gt;
&lt;P&gt;Vault Professional 2019&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 08:41:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8504200#M92907</guid>
      <dc:creator>RoyWickrama_RWEI</dc:creator>
      <dc:date>2019-01-07T08:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8504240#M92911</link>
      <description>&lt;P&gt;Could you upload the code by text?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 09:08:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8504240#M92911</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-01-07T09:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8505562#M92933</link>
      <description>&lt;P&gt;His code is in the .idw file.&lt;/P&gt;
&lt;P&gt;The code attempts to USE a property, then catches the error then creates the property.&amp;nbsp; The Catch then creates the property, but you then used the variable prop in the message box.&amp;nbsp; However you forgot to add "prop = "on the previous add line. (hi2 runs, hi2.1 runs, then error) .&lt;/P&gt;
&lt;PRE&gt;Catch
	MsgBox("hi2")
		customPropertySet.Add("TEST", oCustiProperties_Array.Item(i))
			MsgBox("hi2.1")
		MessageBox.Show(prop.Name &amp;amp; ": ADDED" &amp;amp; vbLf &amp;amp; prop.Name &amp;amp; " (VALUE): " &amp;amp; prop.Value, "CUST PROP")
			MsgBox("hi2.2")
		oPrompt = "ASSIGN DATA"
			MsgBox("hi2.3")
	End Try&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Jan 2019 19:03:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8505562#M92933</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-01-07T19:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8506404#M92940</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the reply. My badness: after struggling few hours, I rushed to post for help.&lt;/P&gt;
&lt;P&gt;Files are attached here to and code is shown below;&lt;/P&gt;
&lt;PRE&gt;Sub main()
oCust_Prop_Sub()
End Sub

Sub oCust_Prop_Sub()
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document

'Look at the model file referenced in the open document
Dim docFile As Document
If ThisDoc.ModelDocument IsNot Nothing Then
docFile = ThisDoc.ModelDocument
Else
MessageBox.Show("NOT OK, This drawing has no model reference", "iLogic")
Return
End If

'oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'format model file name                   
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String 
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 

'define the property set
customPropertySet = docFile.PropertySets.Item("Inventor User Defined Properties")

oName_Prop1 = "TOTAL QTY"
oName_Prop2 = "ROLLING_ALLOWANCE"

Dim oCustiProperties_Array As New ArrayList	
oCustiProperties_Array.Add(oName_Prop1)	
oCustiProperties_Array.Add(oName_Prop2)

For i = 0 To oCustiProperties_Array.Count-1
	'look for the custom propety and add it if not found 
	Try
		prop = customPropertySet.Item(oCustiProperties_Array.Item(i))
		MessageBox.Show(prop.Name &amp;amp; ": EXISTS" _
		&amp;amp; vbLf &amp;amp; prop.Name &amp;amp; " (VALUE): " &amp;amp; prop.Value, "CUST PROP")
		oPrompt = "EDIT/ASSIGN DATA"
	Catch
		customPropertySet.Add("TEST", oCustiProperties_Array.Item(i))
		MessageBox.Show(prop.Name &amp;amp; ": ADDED" _
		&amp;amp; vbLf &amp;amp; prop.Name &amp;amp; " (VALUE): " &amp;amp; prop.Value, "CUST PROP")
		oPrompt = "ASSIGN DATA"
	End Try
	prop.Value = InputBox(oPrompt, prop.Name, prop.Value)
Next i
iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate()
End Sub

&lt;/PRE&gt;
&lt;P&gt;Roy Wickrama&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 04:29:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8506404#M92940</guid>
      <dc:creator>RoyWickrama_RWEI</dc:creator>
      <dc:date>2019-01-08T04:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8506596#M92944</link>
      <description>&lt;PRE&gt;Sub main()
oCust_Prop_Sub()
End Sub

Sub oCust_Prop_Sub()
'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document

'Look at the model file referenced in the open document
Dim docFile As Document
If ThisDoc.ModelDocument IsNot Nothing Then
docFile = ThisDoc.ModelDocument
Else
MessageBox.Show("NOT OK, This drawing has no model reference", "iLogic")
Return
End If

'oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'format model file name                   
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String 
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 

'define the property set
customPropertySet = docFile.PropertySets.Item("Inventor User Defined Properties")

oName_Prop1 = "TOTAL QTY"
oName_Prop2 = "ROLLING_ALLOWANCE"

Dim oCustiProperties_Array As New ArrayList	
oCustiProperties_Array.Add(oName_Prop1)	
oCustiProperties_Array.Add(oName_Prop2)

For i = 0 To oCustiProperties_Array.Count-1
	'look for the custom propety and add it if not found 
	Try
		prop = customPropertySet.Item(oCustiProperties_Array.Item(i))
		MessageBox.Show(prop.Name &amp;amp; ": EXISTS" _
		&amp;amp; vbLf &amp;amp; prop.Name &amp;amp; " (VALUE): " &amp;amp; prop.Value, "CUST PROP")
		oPrompt = "EDIT/ASSIGN DATA"
	Catch
		customPropertySet.Add("TEST", oCustiProperties_Array.Item(i))&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT color="#00ff00"&gt;		prop = customPropertySet.Item(oCustiProperties_Array.Item(i))&lt;/FONT&gt;&lt;/STRONG&gt;
		MessageBox.Show(prop.Name &amp;amp; ": ADDED" _
		&amp;amp; vbLf &amp;amp; prop.Name &amp;amp; " (VALUE): " &amp;amp; prop.Value, "CUST PROP")
		oPrompt = "ASSIGN DATA"
	End Try
	prop.Value = InputBox(oPrompt, prop.Name, prop.Value)
Next i
iLogicVb.UpdateWhenDone = True
InventorVb.DocumentUpdate()
End Sub
&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Jan 2019 07:48:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8506596#M92944</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-01-08T07:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8507830#M92968</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/473476"&gt;@bradeneuropeArthur&lt;/a&gt;, the .Add command returns the object.&amp;nbsp; So his modification works fine as a one liner, and doesn't require the second line to get the item.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;prop = &lt;SPAN&gt;customPropertySet.Add("TEST", oCustiProperties_Array.Item(i))&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 16:10:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8507830#M92968</guid>
      <dc:creator>JamieVJohnson2</dc:creator>
      <dc:date>2019-01-08T16:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8507856#M92971</link>
      <description>&lt;P&gt;That is correct!&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Autodesk Software:&lt;/STRONG&gt; Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018&lt;BR /&gt;&lt;STRONG&gt;Programming Skills:&lt;/STRONG&gt; Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/dimension-component-part-and-assembly/idi-p/7523011" target="_blank"&gt;Dimension Component!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/export-partlist-default-configuration/idc-p/7422221#M21416" target="_blank"&gt;Partlist Export!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/derived-part-and-assembly-copy-i-properties/idi-p/6349392" target="_blank"&gt;Derive I-properties!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/inventor-vault-prompts-settings-amp-vault-prompts-settings-via/idi-p/7641767" target="_blank"&gt;Vault Prompts Via API!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/vault-ideas/vault-professional-handbook-or-manual-to-be-provided/idi-p/7653669" target="_blank"&gt;Vault Handbook/Manual!&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ideas/drawing-toggle-sheets/idi-p/7708757" target="_blank"&gt;Drawing Toggle Sheets!&lt;/A&gt; | &lt;A href="https://forums.autodesk.com/t5/inventor-ideas/open-files-automatically-with-quot-defer-update-quot-on-read/idi-p/7762709" target="_blank"&gt;Vault Defer Update!&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;! For administrative reasons, please mark a &lt;STRONG&gt;"Solution as solved"&lt;/STRONG&gt; when the issue is solved !&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 16:14:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8507856#M92971</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2019-01-08T16:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error message: Object variable or With block variable not set</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8517758#M93146</link>
      <description>&lt;P&gt;Dear Bradedeurope;&lt;/P&gt;
&lt;P&gt;Thanks a lot.&lt;/P&gt;
&lt;P&gt;It runs too smooth.&lt;/P&gt;
&lt;P&gt;I will build up the rest of my rule.Your code is a great help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Roy Wickrama&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jan 2019 05:37:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-message-object-variable-or-with-block-variable-not-set/m-p/8517758#M93146</guid>
      <dc:creator>RoyWickrama_RWEI</dc:creator>
      <dc:date>2019-01-12T05:37:44Z</dc:date>
    </item>
  </channel>
</rss>

