<?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: File Browser in VBA Editor in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4842291#M125927</link>
    <description>&lt;P&gt;I ended up needing it again for something else later on in my program and used this. It allowed me to browse a file from a path previously defined by the user and input it in to a textbox in Form3....now I need to make the open button work! Step by step....almost to the hard part of this project. Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long&lt;BR /&gt;Public Type OPENFILENAME&lt;BR /&gt;lStructSize As Long&lt;BR /&gt;hwndOwner As Long&lt;BR /&gt;hInstance As Long&lt;BR /&gt;lpstrFilter As String&lt;BR /&gt;lpstrCustomFilter As String&lt;BR /&gt;nMaxCustFilter As Long&lt;BR /&gt;nFilterIndex As Long&lt;BR /&gt;lpstrFile As String&lt;BR /&gt;nMaxFile As Long&lt;BR /&gt;lpstrFileTitle As String&lt;BR /&gt;nMaxFileTitle As Long&lt;BR /&gt;lpstrInitialDir As String&lt;BR /&gt;lpstrTitle As String&lt;BR /&gt;flags As Long&lt;BR /&gt;nFileOffset As Integer&lt;BR /&gt;nFileExtension As Integer&lt;BR /&gt;lpstrDefExt As String&lt;BR /&gt;lCustData As Long&lt;BR /&gt;lpfnHook As Long&lt;BR /&gt;lpTemplateName As String&lt;BR /&gt;End Type&lt;BR /&gt;Public Function SelectFileOpenDialog()&lt;BR /&gt;Dim strTemp, strTemp1, pathStr As String&lt;BR /&gt;Dim i, n, j As Long&lt;BR /&gt;Dim OpenFile As OPENFILENAME&lt;BR /&gt;Dim lReturn As Long&lt;BR /&gt;Dim sFilter As String&lt;BR /&gt;Dim Fname As String&lt;BR /&gt;OpenFile.lStructSize = Len(OpenFile)&lt;BR /&gt;sFilter = "Assembly Files (*.iam)" &amp;amp; Chr(0) &amp;amp; "*.IAM" &amp;amp; Chr(0)&lt;BR /&gt;OpenFile.lpstrFilter = sFilter&lt;BR /&gt;OpenFile.nFilterIndex = 1&lt;BR /&gt;OpenFile.lpstrFile = String(257, 0)&lt;BR /&gt;OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1&lt;BR /&gt;OpenFile.lpstrFileTitle = OpenFile.lpstrFile&lt;BR /&gt;OpenFile.nMaxFileTitle = OpenFile.nMaxFile&lt;BR /&gt;OpenFile.lpstrInitialDir = dir_path&lt;BR /&gt;OpenFile.lpstrTitle = "Select An Assembly"&lt;BR /&gt;OpenFile.flags = 0&lt;BR /&gt;lReturn = GetOpenFileName(OpenFile)&lt;BR /&gt;If lReturn = 0 Then&lt;BR /&gt;MsgBox "No file selected. Please try again."&lt;BR /&gt;Else&lt;BR /&gt;Fname = Trim$(OpenFile.lpstrFileTitle) ' copy the filename to "Fname"&lt;BR /&gt;n = FileLen(OpenFile.lpstrFile) 'length of the file&lt;BR /&gt;Resolve.FileName.Text = Fname&lt;BR /&gt;&lt;BR /&gt;End If&lt;BR /&gt;End Function&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Feb 2014 20:12:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-02-26T20:12:00Z</dc:date>
    <item>
      <title>File Browser in VBA Editor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4834945#M125923</link>
      <description>&lt;P&gt;I've been tackling this problem for about 4 hours now and I'm running out of ideas. I've tried a lot of things and Googled aplenty, but certain things, like Common Dialog won't run on this computer. What I'm trying to do is simply open a file browser (preferably only for .ipj files)&amp;nbsp; in Inventor VBA Editor. I will also attach a picture of Form1 to explain what it is I'm doing. It needs to access our K:\\ drive and U:\\ drive as well as the C:\\ drive.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="Form1.JPG" border="0" alt="Form1.JPG" width="582" align="middle" src="http://forums.autodesk.com/t5/image/serverpage/image-id/83783i3AF899F8A8F6F1D9/image-size/original?v=mpbl-1&amp;amp;px=-1" height="436" /&gt;&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;P&gt;Once the file is selected it is going to display in TextBox1 and the user will be able to prompt the next step of the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The closest I have (that works) is a folder browser, shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Private Sub&lt;/FONT&gt; Browse_Click()&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Dim&lt;/FONT&gt; pathSelected &lt;FONT color="#0000FF"&gt;As String&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color="#339966"&gt;&amp;nbsp; 'This needs to be edited to find files, not just folders...alternatively, add .ipj to end&lt;/FONT&gt; &lt;FONT color="#339966"&gt;of selected path?&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Dim&lt;/FONT&gt; ShellApp &lt;FONT color="#0000FF"&gt;As Object&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Set&lt;/FONT&gt; ShellApp = CreateObject("Shell.Application"). _&lt;BR /&gt;BrowseforFolder(0, "Choose Folder", 0, OpenAt)&lt;BR /&gt;pathSelected = ShellApp.self.Path&lt;BR /&gt;Me.TextBox1.Text = pathSelected&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;Set&lt;/FONT&gt; ShellApp = &lt;FONT color="#0000FF"&gt;Nothing&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;End Sub&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#808080"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#808080"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#808080"&gt;Any ideas are greatly appreciated and welcomed!!&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#808080"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#808080"&gt;Thanks,&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#808080"&gt;Alyssa&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Feb 2014 15:18:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4834945#M125923</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-24T15:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: File Browser in VBA Editor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4834977#M125924</link>
      <description>Side note, I'm new to this. I learned Visual Basic....on Friday. So I have quite a lot to learn.</description>
      <pubDate>Mon, 24 Feb 2014 15:21:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4834977#M125924</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-24T15:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: File Browser in VBA Editor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4838765#M125925</link>
      <description>&lt;P&gt;I have not found a solution, but circumvented the process instead and no longer require help.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2014 18:48:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4838765#M125925</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-25T18:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: File Browser in VBA Editor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4841093#M125926</link>
      <description>I found some code to do an open file dialog. You can find it in the thread I'm linking to.&lt;BR /&gt;&lt;BR /&gt;&lt;A target="_blank" href="http://forums.autodesk.com/t5/Inventor-Customization/Inventor-2013-FileDialog-that-does-not-point-to-current-project/m-p/4332780#M45103"&gt;http://forums.autodesk.com/t5/Inventor-Customization/Inventor-2013-FileDialog-that-does-not-point-to-current-project/m-p/4332780#M45103&lt;/A&gt;</description>
      <pubDate>Wed, 26 Feb 2014 14:37:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4841093#M125926</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2014-02-26T14:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: File Browser in VBA Editor</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4842291#M125927</link>
      <description>&lt;P&gt;I ended up needing it again for something else later on in my program and used this. It allowed me to browse a file from a path previously defined by the user and input it in to a textbox in Form3....now I need to make the open button work! Step by step....almost to the hard part of this project. Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long&lt;BR /&gt;Public Type OPENFILENAME&lt;BR /&gt;lStructSize As Long&lt;BR /&gt;hwndOwner As Long&lt;BR /&gt;hInstance As Long&lt;BR /&gt;lpstrFilter As String&lt;BR /&gt;lpstrCustomFilter As String&lt;BR /&gt;nMaxCustFilter As Long&lt;BR /&gt;nFilterIndex As Long&lt;BR /&gt;lpstrFile As String&lt;BR /&gt;nMaxFile As Long&lt;BR /&gt;lpstrFileTitle As String&lt;BR /&gt;nMaxFileTitle As Long&lt;BR /&gt;lpstrInitialDir As String&lt;BR /&gt;lpstrTitle As String&lt;BR /&gt;flags As Long&lt;BR /&gt;nFileOffset As Integer&lt;BR /&gt;nFileExtension As Integer&lt;BR /&gt;lpstrDefExt As String&lt;BR /&gt;lCustData As Long&lt;BR /&gt;lpfnHook As Long&lt;BR /&gt;lpTemplateName As String&lt;BR /&gt;End Type&lt;BR /&gt;Public Function SelectFileOpenDialog()&lt;BR /&gt;Dim strTemp, strTemp1, pathStr As String&lt;BR /&gt;Dim i, n, j As Long&lt;BR /&gt;Dim OpenFile As OPENFILENAME&lt;BR /&gt;Dim lReturn As Long&lt;BR /&gt;Dim sFilter As String&lt;BR /&gt;Dim Fname As String&lt;BR /&gt;OpenFile.lStructSize = Len(OpenFile)&lt;BR /&gt;sFilter = "Assembly Files (*.iam)" &amp;amp; Chr(0) &amp;amp; "*.IAM" &amp;amp; Chr(0)&lt;BR /&gt;OpenFile.lpstrFilter = sFilter&lt;BR /&gt;OpenFile.nFilterIndex = 1&lt;BR /&gt;OpenFile.lpstrFile = String(257, 0)&lt;BR /&gt;OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1&lt;BR /&gt;OpenFile.lpstrFileTitle = OpenFile.lpstrFile&lt;BR /&gt;OpenFile.nMaxFileTitle = OpenFile.nMaxFile&lt;BR /&gt;OpenFile.lpstrInitialDir = dir_path&lt;BR /&gt;OpenFile.lpstrTitle = "Select An Assembly"&lt;BR /&gt;OpenFile.flags = 0&lt;BR /&gt;lReturn = GetOpenFileName(OpenFile)&lt;BR /&gt;If lReturn = 0 Then&lt;BR /&gt;MsgBox "No file selected. Please try again."&lt;BR /&gt;Else&lt;BR /&gt;Fname = Trim$(OpenFile.lpstrFileTitle) ' copy the filename to "Fname"&lt;BR /&gt;n = FileLen(OpenFile.lpstrFile) 'length of the file&lt;BR /&gt;Resolve.FileName.Text = Fname&lt;BR /&gt;&lt;BR /&gt;End If&lt;BR /&gt;End Function&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 20:12:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/file-browser-in-vba-editor/m-p/4842291#M125927</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-02-26T20:12:00Z</dc:date>
    </item>
  </channel>
</rss>

