How to open a file with one line of code!
No attachments for this post
You create a funtion that can open a file with just one line of code.
Original Author: Nick Pordash
Form is your Form, RichTextBox is your RichTextBox, and
Commondialog is your Commondialog.
This code requires a Commondialog and a RichTextBox.
The file you just open in the richtextbox you picked.
Public Function Openf(frm As Form, Text As RichTextBox, Dialog As CommonDialog)
On Error Resume Next
Dialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*|" 'Edit the filter how you want it
Dialog.Flags = cdlOFNPathMustExist & cdlOFNHideReadOnly
Dialog.Action = 1
Screen.MousePointer = vbHourglass
Text.Text = ""
Screen.MousePointer = vbNormal
Private Sub Command1_Click()
Call Openf(Me, RichTextBox1, CommonDialog1)
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.