<?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: ApplicationEvents  OnSaveDocument OnOpenDocument in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6831715#M103728</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But i still got the same issue.&lt;/P&gt;
&lt;P&gt;As you can see in the screencast the event dosnt fire before the save as dialog shows..&lt;/P&gt;
&lt;P&gt;And in this case BeforeOrAfter contains&amp;nbsp;kAbort {4099}, so it dosnt come empty, just to late.&lt;/P&gt;
&lt;P&gt;I dont get it &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Namespace TheNameSpace

Private WithEvents m_ApplicationEvents As Inventor.ApplicationEvents

	Public Class StandardAddInServer

		Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal FirstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate
			 m_ApplicationEvents = m_inventorApplication.ApplicationEvents
			AddHandler m_ApplicationEvents.OnSaveDocument, AddressOf m_ApplicationEvents_OnSaveDocument
		End Sub

		Private Sub m_ApplicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document,
				ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap,
				ByRef HandlingCode As Inventor.HandlingCodeEnum)

					If BeforeOrAfter = EventTimingEnum.kBefore Then
						HandlingCode = HandlingCodeEnum.kEventHandled
						MsgBox("Hey")
					End If	
		End Sub

	End Class
	
End Namespace&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="02c821e6-364d-4807-b61d-3f5cecea7397" class="myscreencast-iframe iframe-container active-myscreencast"&gt;&lt;IFRAME src="https://screencast.autodesk.com/Embed/Timeline/02c821e6-364d-4807-b61d-3f5cecea7397" width="640" height="650" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" style="display: inline;"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 25 Jan 2017 23:26:42 GMT</pubDate>
    <dc:creator>JoAntt</dc:creator>
    <dc:date>2017-01-25T23:26:42Z</dc:date>
    <item>
      <title>ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6829587#M103724</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a problem in my Inventor 2014 addin with applicationsEvents.&lt;/P&gt;&lt;P&gt;The code below fires not before but 2 times after event, what is wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'In Class StandardAddInServer
Private WithEvents m_ApplicationEvents As Inventor.ApplicationEvents

 'in Public Sub Activate
 
            m_ApplicationEvents = m_inventorApplication.ApplicationEvents
            AddHandler m_ApplicationEvents.OnSaveDocument, AddressOf m_ApplicationEvents_OnSaveDocument

            m_ApplicationEvents = m_inventorApplication.ApplicationEvents
            AddHandler m_ApplicationEvents.OnOpenDocument, AddressOf Me.m_ApplicationEvents_OnOpenDocument
			
			
			' And then
			

        Private Sub m_ApplicationEvents_OnOpenDocument(ByVal DocumentObject As Inventor._Document,
                                                       ByVal FullDocumentName As String,
                                                       ByVal BeforeOrAfter As Inventor.EventTimingEnum,
                                                       ByVal Context As Inventor.NameValueMap,
                                                       ByRef HandlingCode As Inventor.HandlingCodeEnum)

            Dim kBefore As EventTimingEnum = Nothing

            If BeforeOrAfter = kBefore Then
                MessageBox.Show("open - Before")
            Else
                MessageBox.Show("Open - After")
            End If

        End Sub


        Private Sub m_ApplicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document,
        ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap,
        ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_ApplicationEvents.OnSaveDocument


            Dim kBefore As EventTimingEnum = Nothing

            If BeforeOrAfter = kBefore Then
                MessageBox.Show("Save as - Before")
            Else
                MessageBox.Show("Save as - After")
            End If


        End Sub&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Jan 2017 10:06:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6829587#M103724</guid>
      <dc:creator>JoAntt</dc:creator>
      <dc:date>2017-01-25T10:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6829759#M103725</link>
      <description>&lt;P&gt;You used it wrong:&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Dim kBefore As EventTimingEnum = Nothing&lt;/FONT&gt;&lt;/STRONG&gt;

If BeforeOrAfter = kBefore Then
     MessageBox.Show("Save as - Before")
Else
     MessageBox.Show("Save as - After")
End If&lt;/PRE&gt;
&lt;P&gt;With the code above you're basically checking if the &lt;STRONG&gt;BeforeOrAfter&lt;/STRONG&gt; is &lt;STRONG&gt;Nothing&lt;/STRONG&gt;, which is wrong.&lt;/P&gt;
&lt;P&gt;Here's the correct use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;If BeforeOrAfter = EventTimingEnum.kBefore Then
     MessageBox.Show("Save as - Before")
Else
     MessageBox.Show("Save as - After")
End If&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 11:39:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6829759#M103725</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-01-25T11:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6830309#M103726</link>
      <description>&lt;P&gt;Ah, ok, My bad..&lt;BR /&gt;What got me confused was that i didnt understand that the onSaveDocument dosnt includes the actual opensave dialog.&lt;BR /&gt;I am trying to prevent the save as dialog to pop up and capture that.&lt;/P&gt;&lt;P&gt;So i tried OnFileSaveAsDialog and a bunch of others with the EventWatcher and i cant get any of them to tell me before and after save as dialog happens.&lt;BR /&gt;the OnFileSaveAsDialog dosnt fire att all.&lt;BR /&gt;Any ideas on that?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 15:21:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6830309#M103726</guid>
      <dc:creator>JoAntt</dc:creator>
      <dc:date>2017-01-25T15:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6830565#M103727</link>
      <description>&lt;P&gt;Hey, remove the part "&lt;STRONG&gt; Handles m_ApplicationEvents.OnSaveDocument&lt;/STRONG&gt;" that's behind the sub.&lt;/P&gt;
&lt;P&gt;You already have the handler set, so there's no need for that and it might cause the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To prevent the save dialog from even showing up you can use this:&lt;/P&gt;
&lt;PRE&gt;If BeforeOrAfter = EventTimingEnum.kBefore Then
     HandlingCode = HandlingCodeEnum.kEventHandled
     &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;'Here you can use the DocumentObject to do whatever you want with the file instead&lt;/STRONG&gt;&lt;/FONT&gt;
End If&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You're also setting the &lt;STRONG&gt;&lt;/STRONG&gt;"&lt;STRONG&gt;m_ApplicationEvents = m_inventorApplication.ApplicationEvents&lt;/STRONG&gt;" twice. Scrap the second one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 16:37:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6830565#M103727</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-01-25T16:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6831715#M103728</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But i still got the same issue.&lt;/P&gt;
&lt;P&gt;As you can see in the screencast the event dosnt fire before the save as dialog shows..&lt;/P&gt;
&lt;P&gt;And in this case BeforeOrAfter contains&amp;nbsp;kAbort {4099}, so it dosnt come empty, just to late.&lt;/P&gt;
&lt;P&gt;I dont get it &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Namespace TheNameSpace

Private WithEvents m_ApplicationEvents As Inventor.ApplicationEvents

	Public Class StandardAddInServer

		Public Sub Activate(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal FirstTime As Boolean) Implements Inventor.ApplicationAddInServer.Activate
			 m_ApplicationEvents = m_inventorApplication.ApplicationEvents
			AddHandler m_ApplicationEvents.OnSaveDocument, AddressOf m_ApplicationEvents_OnSaveDocument
		End Sub

		Private Sub m_ApplicationEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document,
				ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap,
				ByRef HandlingCode As Inventor.HandlingCodeEnum)

					If BeforeOrAfter = EventTimingEnum.kBefore Then
						HandlingCode = HandlingCodeEnum.kEventHandled
						MsgBox("Hey")
					End If	
		End Sub

	End Class
	
End Namespace&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="02c821e6-364d-4807-b61d-3f5cecea7397" class="myscreencast-iframe iframe-container active-myscreencast"&gt;&lt;IFRAME src="https://screencast.autodesk.com/Embed/Timeline/02c821e6-364d-4807-b61d-3f5cecea7397" width="640" height="650" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" style="display: inline;"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Jan 2017 23:26:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6831715#M103728</guid>
      <dc:creator>JoAntt</dc:creator>
      <dc:date>2017-01-25T23:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6832190#M103729</link>
      <description>&lt;P&gt;If you would proceed further (and save the document under new name), you would find out that the event actually will fire (both before and after save).&lt;/P&gt;
&lt;P&gt;What is happening is that Inventor prompts you for a new name and AFTER you provide it it will start the save.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However your problem here is that you want to prevent the Inventor from even showing this dialog.&lt;/P&gt;
&lt;P&gt;You can try something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;AddHandler m_inventorApplication.FileUIEvents.OnFileSaveAsDialog, AddressOf Me.m_ApplicationEvents_OnSaveAsDialog


Private Sub m_ApplicationEvents_OnSaveAsDialog(ByRef FileTypes() As String, SaveCopyAs As Boolean, _&lt;BR /&gt;ParentHWND As Integer, ByRef FileName As String, Context As Inventor.NameValueMap, _&lt;BR /&gt;ByRef HandlingCode As Inventor.HandlingCodeEnum)
     HandlingCode = HandlingCodeEnum.kEventHandled
     'my own saving code
End Sub

&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Jan 2017 06:30:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6832190#M103729</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-01-26T06:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6834537#M103730</link>
      <description>Dosnt work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;FileUIEvents.OnFileSaveAsDialog dosnt capture anything.&lt;BR /&gt;Im starting to belive that this have been forgotten when upgrading to current save as dialog.&lt;BR /&gt;I have tried all dialog, fileui, and application events but no one can capture before save as dialog.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Ive even tried to capture this in inventor 2016 but its the same.&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Any one have an idea about this?</description>
      <pubDate>Thu, 26 Jan 2017 23:13:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6834537#M103730</guid>
      <dc:creator>JoAntt</dc:creator>
      <dc:date>2017-01-26T23:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6835351#M103731</link>
      <description>&lt;P&gt;Finally i got it to work!!!!&lt;/P&gt;&lt;P&gt;This is how to prevent the Save as dialog from showing&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Start with reading the link below and set the interop types to false, the save as dialog handler dosnt work with this on true.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://modthemachine.typepad.com/my_weblog/2012/07/set-embed-interop-types-to-false-to-avoid-problems-with-events.html" target="_blank"&gt;modthemachine &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'Namespace TheNameSpace
	'Public Class StandardAddInServer
		Private WithEvents m_FileUIEvents As Inventor.FileUIEvents
		'Public Sub Activate
			m_FileUIEvents = m_inventorApplication.FileUIEvents
			AddHandler m_inventorApplication.FileUIEvents.OnFileSaveAsDialog, AddressOf m_FileUIEvents_OnFileSaveAsDialog
		'End sub
			Private Sub m_FileUIEvents_OnFileSaveAsDialog(ByRef FileTypes() As String, SaveCopyAs As Boolean,
			ParentHWND As Integer, ByRef FileName As String, Context As Inventor.NameValueMap,
				ByRef HandlingCode As Inventor.HandlingCodeEnum)
				HandlingCode = HandlingCodeEnum.kEventHandled
				MsgBox("I am the new Save As Dialog!")
			End Sub
	'End Class
'End Namespace&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Jan 2017 11:37:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6835351#M103731</guid>
      <dc:creator>JoAntt</dc:creator>
      <dc:date>2017-01-27T11:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6835552#M103732</link>
      <description>&lt;P&gt;Now I'm interested where did the problem come from and even more, why wasn't it fixed in 5 years.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 13:02:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/6835552#M103732</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2017-01-27T13:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: ApplicationEvents  OnSaveDocument OnOpenDocument</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/9484694#M103733</link>
      <description>&lt;P&gt;Hi Im using inventor 2019 and just starting programming two weeks ago.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I finally after various attempts approached the code to fire the messagebox, and coded the dialogbox, however, I'm not able to fire the saveas() option of the dialog. The open() dialog works perfect if i just change it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another problem im having when testing with the open dialog box it's not showing the Initialdirectory or filename. Do you know how fix this issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is part of the code I have so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Private Sub m_FileUIEvents_OnFileSaveAsDialog(ByRef FileTypes() As String, SaveCopyAs As Boolean,&lt;BR /&gt;ParentHWND As Integer, ByRef FileName As String, Context As Inventor.NameValueMap,&lt;BR /&gt;ByRef HandlingCode As Inventor.HandlingCodeEnum)&lt;/P&gt;&lt;P&gt;HandlingCode = HandlingCodeEnum.kEventHandled&lt;/P&gt;&lt;P&gt;'MsgBox("new File Dialog will be opened")&lt;/P&gt;&lt;P&gt;filedialog()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;Sub SaveAsDialog() 'define the active document&lt;BR /&gt;Dim oDoc = m_inventorApplication.ActiveDocument&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim CurrentFilename = oDoc.FullDocumentName&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;'create a file dialog box&lt;BR /&gt;Dim oFileDlg As Inventor.FileDialog = Nothing&lt;/P&gt;&lt;P&gt;Call m_inventorApplication.CreateFileDialog(oFileDlg)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Call m_inventorApplication.CreateFileDialog(oFileDlg)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim Filetype As String&lt;/P&gt;&lt;P&gt;'check file type and set dialog filter&lt;BR /&gt;If m_inventorApplication.ActiveDocumentType = DocumentTypeEnum.kPartDocumentObject Then&lt;BR /&gt;oFileDlg.Filter = "Autodesk Inventor Part Files (*.ipt)|*.ipt"&lt;BR /&gt;Filetype = ".ipt"&lt;BR /&gt;ElseIf m_inventorApplication.ActiveDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then&lt;BR /&gt;oFileDlg.Filter = "Autodesk Inventor Assembly Files (*.iam)|*.iam"&lt;BR /&gt;Filetype = ".iam"&lt;BR /&gt;ElseIf m_inventorApplication.ActiveDocumentType = DocumentTypeEnum.kDrawingDocumentObject Then&lt;BR /&gt;oFileDlg.Filter = "Autodesk Inventor Drawing Files (*.idw)|*.idw"&lt;BR /&gt;Filetype = ".idw"&lt;BR /&gt;End If&lt;/P&gt;&lt;P&gt;'Initial conditions of the dialog box&lt;BR /&gt;'Grabs the filename from the subrutine and place it in the text&lt;BR /&gt;Dim GenFileNumber As String&lt;/P&gt;&lt;P&gt;'FileNameGenerator(GenFileNumber)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'set the directory to open the dialog at&lt;BR /&gt;oFileDlg.InitialDirectory = m_inventorApplication.FileLocations.Workspace&lt;BR /&gt;'set the file name string to use in the input box&lt;BR /&gt;'********* on this place I will catch the value from the sub rutine&lt;BR /&gt;oFileDlg.FileName = "**** That" 'without extension&lt;/P&gt;&lt;P&gt;'work with an error created by the user backing out of the save&lt;BR /&gt;oFileDlg.CancelError = True&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;'specify the file dialog as a save dialog (rather than a open dialog)&lt;BR /&gt;MsgBox("Im at this section just before opening the basterd")&lt;BR /&gt;oFileDlg.ShowSave()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'catch an empty string in the imput&lt;BR /&gt;If Err.Number &amp;lt;&amp;gt; 0 Then&lt;BR /&gt;MsgBox("No File Saved.", "iLogic: Dialog Canceled")&lt;BR /&gt;'Goes to the subfunction to rever number generated&lt;BR /&gt;RevertGenNumber()&lt;BR /&gt;ElseIf oFileDlg.FileName &amp;lt;&amp;gt; "" Then&lt;BR /&gt;Dim MyFile = oFileDlg.FileName&lt;BR /&gt;'save the file&lt;BR /&gt;oDoc.SaveAs(MyFile, False) 'True = Save As Copy &amp;amp; False = Save As&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2020 09:22:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/applicationevents-onsavedocument-onopendocument/m-p/9484694#M103733</guid>
      <dc:creator>antoniobaron</dc:creator>
      <dc:date>2020-05-01T09:22:40Z</dc:date>
    </item>
  </channel>
</rss>

