<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FFile_Path%2FTextStream</id>
		<title>VBA/Excel/Access/Word/File Path/TextStream - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VBA%2FExcel%2FAccess%2FWord%2FFile_Path%2FTextStream"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/File_Path/TextStream&amp;action=history"/>
		<updated>2026-04-05T05:48:58Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/File_Path/TextStream&amp;diff=1450&amp;oldid=prev</id>
		<title> в 16:33, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/File_Path/TextStream&amp;diff=1450&amp;oldid=prev"/>
				<updated>2010-05-26T16:33:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:33, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/File_Path/TextStream&amp;diff=1451&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VBA/Excel/Access/Word/File_Path/TextStream&amp;diff=1451&amp;oldid=prev"/>
				<updated>2010-05-26T12:47:07Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==On Error/Goto and the Err Object==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Private Sub ReadTxtFile()&lt;br /&gt;
    Dim myFileSystemObject As FileSystemObject, aFile As TextStream&lt;br /&gt;
    Dim fileContent As String, colStr As String&lt;br /&gt;
    Dim I As Integer, ms As Integer&lt;br /&gt;
    Dim fPath As String&lt;br /&gt;
    On Error GoTo ErrorHandler&lt;br /&gt;
    I = ActiveCell.Row&lt;br /&gt;
    Set myFileSystemObject = New FileSystemObject&lt;br /&gt;
    fPath = &amp;quot;D:\myFile.txt&amp;quot;&lt;br /&gt;
    Set aFile = myFileSystemObject.OpenTextFile(fPath, 1)&lt;br /&gt;
    Do While Not aFile.AtEndOfStream&lt;br /&gt;
        fileContent = aFile.ReadLine&lt;br /&gt;
        Debug.Print fileContent&lt;br /&gt;
    Loop&lt;br /&gt;
    aFile.Close     &amp;quot;Close file and convert lines of data to columns&lt;br /&gt;
    Set myFileSystemObject = Nothing&lt;br /&gt;
    Set aFile = Nothing&lt;br /&gt;
    Exit Sub&lt;br /&gt;
ErrorHandler:&lt;br /&gt;
    If Err.Number = 53 Or Err.Number = 76 Then&lt;br /&gt;
        ms = MsgBox(Err.Description &amp;amp; vbCrLf &amp;amp; _&lt;br /&gt;
                  &amp;quot;Do you want to look for the file?&amp;quot;, vbYesNo)&lt;br /&gt;
        If ms = 6 Then&lt;br /&gt;
            fPath = ShowFileDialog(fPath)&lt;br /&gt;
            If fPath &amp;lt;&amp;gt; &amp;quot;Cancelled&amp;quot; Then Resume&lt;br /&gt;
        Else&lt;br /&gt;
            MsgBox &amp;quot;Resolve file error before continuing.&amp;quot;&lt;br /&gt;
        End If&lt;br /&gt;
    Else&lt;br /&gt;
        MsgBox Err.Number &amp;amp; &amp;quot;: &amp;quot; &amp;amp; Err.Description&lt;br /&gt;
    End If&lt;br /&gt;
End Sub&lt;br /&gt;
Private Function ShowFileDialog(fName As String) As String&lt;br /&gt;
    Dim fd As FileDialog&lt;br /&gt;
    Dim I As Integer&lt;br /&gt;
    Set fd = Application.FileDialog(msoFileDialogOpen)&lt;br /&gt;
    With fd&lt;br /&gt;
        .AllowMultiSelect = False&lt;br /&gt;
        .FilterIndex = 2&lt;br /&gt;
        .Title = &amp;quot;Find File&amp;quot;&lt;br /&gt;
        .InitialFileName = fName&lt;br /&gt;
        If .Show = -1 Then&lt;br /&gt;
            ShowFileDialog = .SelectedItems(1)&lt;br /&gt;
        Else&lt;br /&gt;
            ShowFileDialog = &amp;quot;Cancelled&amp;quot;&lt;br /&gt;
        End If&lt;br /&gt;
    End With&lt;br /&gt;
    Set fd = Nothing&lt;br /&gt;
End Function&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Read text file==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Public Sub ReadTxtFile()&lt;br /&gt;
    Dim myFileSystemObject As FileSystemObject&lt;br /&gt;
    Dim aFile As TextStream&lt;br /&gt;
    Set myFileSystemObject = New FileSystemObject&lt;br /&gt;
    Set aFile = myFileSystemObject.OpenTextFile(&amp;quot;C:\myFile.txt&amp;quot;, 1)&lt;br /&gt;
    Do While Not aFile.AtEndOfStream&lt;br /&gt;
        Debug.Print aFile.ReadLine&lt;br /&gt;
    Loop&lt;br /&gt;
    aFile.Close     &amp;quot;Close file and convert lines of data to columns&lt;br /&gt;
    Set myFileSystemObject = Nothing&lt;br /&gt;
    Set aFile = Nothing&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==The TextStream Object==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;vb&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Sub CreateTxtFile()&lt;br /&gt;
    Dim myFileSystemObject As FileSystemObject&lt;br /&gt;
    Dim aFile As TextStream&lt;br /&gt;
    Set myFileSystemObject = New FileSystemObject&lt;br /&gt;
    Set aFile = myFileSystemObject.CreateTextFile(&amp;quot;C:\myFile.txt&amp;quot;, True)&lt;br /&gt;
    aFile.WriteLine&lt;br /&gt;
    aFile.Write (&amp;quot;asdf&amp;quot;)    &amp;quot;Write tab-delimited text&lt;br /&gt;
    aFile.Close         &amp;quot;Close file and clear memory&lt;br /&gt;
    Set myFileSystemObject = Nothing&lt;br /&gt;
    Set aFile = Nothing&lt;br /&gt;
End Sub&lt;br /&gt;
 &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>