<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://rayharwood.com/Wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://rayharwood.com/Wiki/index.php?action=history&amp;feed=atom&amp;title=Processing_an_input_file_in_Excel</id>
		<title>Processing an input file in Excel - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://rayharwood.com/Wiki/index.php?action=history&amp;feed=atom&amp;title=Processing_an_input_file_in_Excel"/>
		<link rel="alternate" type="text/html" href="http://rayharwood.com/Wiki/index.php?title=Processing_an_input_file_in_Excel&amp;action=history"/>
		<updated>2026-11-06T06:32:15Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.20.3</generator>

	<entry>
		<id>http://rayharwood.com/Wiki/index.php?title=Processing_an_input_file_in_Excel&amp;diff=32&amp;oldid=prev</id>
		<title>Rayharwood: Created page with &quot;First, you need to include Excel in your project's references.  I prefer to use Microsoft.Office.Interop.Excel Version 12.0.0.0.  Then you need to add this Import statement at...&quot;</title>
		<link rel="alternate" type="text/html" href="http://rayharwood.com/Wiki/index.php?title=Processing_an_input_file_in_Excel&amp;diff=32&amp;oldid=prev"/>
				<updated>2013-05-21T13:39:27Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;First, you need to include Excel in your project&amp;#039;s references.  I prefer to use Microsoft.Office.Interop.Excel Version 12.0.0.0.  Then you need to add this Import statement at...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;First, you need to include Excel in your project's references.  I prefer to use Microsoft.Office.Interop.Excel Version 12.0.0.0.&lt;br /&gt;
&lt;br /&gt;
Then you need to add this Import statement at the top of your file:&lt;br /&gt;
&lt;br /&gt;
    Imports Microsoft.Office.Interop&lt;br /&gt;
&lt;br /&gt;
Don't include Excel on the Imports statement; force yourself to use Excel as a qualifier.  Then add a sub that accepts a path to a file:&lt;br /&gt;
&lt;br /&gt;
    Sub ImportDataFile(ByVal FilePath As String)&lt;br /&gt;
        Dim xlApp As Excel.Application = Nothing&lt;br /&gt;
        Try&lt;br /&gt;
            LogAction(&amp;quot;Starting Staff Survey import...&amp;quot;)&lt;br /&gt;
            LogAction(&amp;quot;Selected file: &amp;quot; &amp;amp; FilePath)&lt;br /&gt;
            LogAction(&amp;quot;Launching Excel and opening file...&amp;quot;)&lt;br /&gt;
            xlApp = New Excel.Application&lt;br /&gt;
            xlApp.Workbooks.Open(FilePath, [ReadOnly]:=True)&lt;br /&gt;
            'Do processing here...&lt;br /&gt;
            LogAction(&amp;quot;Closing file and Excel...&amp;quot;)&lt;br /&gt;
            xlApp.Workbooks(0).Close()&lt;br /&gt;
        Catch ex As Exception&lt;br /&gt;
            LogAction(&amp;quot;Error processing with Excel: &amp;quot; &amp;amp; ex.Message)&lt;br /&gt;
        End Try&lt;br /&gt;
        xlApp.Quit()&lt;br /&gt;
        xlApp = Nothing&lt;br /&gt;
    End Sub&lt;br /&gt;
&lt;br /&gt;
See also [[Open File Dialog]]&lt;/div&gt;</summary>
		<author><name>Rayharwood</name></author>	</entry>

	</feed>