try this, though looking at your code, I am not sure what your doing. I am making this presumption

1) you create a temp file name
2) you delete it if it exists
3) you append the new line chr to your sql text box (on your form??)
4) you write that out to the temp file
5) close the new file
6) re-open it and then read the line count

if that is what your doing then this code will work, though it isnt the best way of doing it

Public TempSQLPath As String
Public SQLUnit As Integer
Public TempSQLPath As String
Public Sub GetSQLFile()
Dim Line As String
Dim Datetime As String
Datetime = Now.ToString("YYYYMMDDhhmmss") '(VB6.Format(Now, "YYYYMMDDhhmmss")
TempSQLPath = TempDir & "\TempSQL" & Datetime & ".sql"
If Dir(TempSQLPath) <> "" Then
Kill(TempSQLPath)
End If
Dim sw As New IO.StreamWriter(TempSQLPath)
sw.Write(SQLBox.Text & Environment.NewLine)
sw.Close()
Dim sr As New IO.StreamReader(TempSQLPath)
Do Until sr.EndOfStream
sr.ReadLine()
NumLines += 1
Loop
sr.Close()
End Sub

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel.
Part 1 of this series discussed basic error handling code using VBA.
http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory.
NOTE: For Outlook 2016 and 2013 perform the exact same steps.
Open a new email: Click the New email button in Outlook.
Start typing the address: …