Loading notepad file in a form using a on click event

shadowraven

Registered User.
Local time
Today, 11:19
Joined
May 14, 2002
Messages
75
I was wondering is it possible for me to be able to load a notepad file in to a form after a button has been pressed. It would be ideal if it was a pop up window which is readonly so users can't edit the text.
 
Last edited:
Try the code below. Just add a text box (Text0) and a command button (cmdGetText).

Private Sub cmdGetText_Click()
Dim objFile As Object, objText As Object
Set objFile = CreateObject("Scripting.FileSystemObject")
Set objText = objFile.OpenTextFile("C:\test.txt")
Me.Text0 = objText.ReadAll
End Sub
 

Users who are viewing this thread

Back
Top Bottom