View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Opening textfile in textbox + moving to top

Please refer the below link
http://support.microsoft.com/kb/209231

You can also use the Line input statement to retrieve a line at a time
--
If this post helps click Yes
---------------
Jacob Skaria


"Gustaf" wrote:

Found this code for opening a textfile in a textbox on a custom VBA form:

Private Sub UserForm_Initialize()

Dim hFile As Long
Dim sFilename As String

sFilename = conLinkHelpdesk

hFile = FreeFile
Open sFilename For Input As #hFile
txtText.Text = Input$(LOF(hFile), hFile)
Close #hFile

End Sub

Works fine, but when the form opens, the cursor is at the bottom, which causes the end of the textfile to show, rather than the beginning. Is there a way to correct this?

Gustaf