Populate Textbox from Txt File

Post number 2 has been selected as the best answer.

Status
Not open for further replies.

Alan McGowan

Senior Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
I am trying to populate multiple textboxes based on the value on each line in a txt file.

Code:
Dim fn As String, ff As Integer, txt As String
fn = "D:\filemail\settings.txt"               '< --- .txt file path
txt = Space(FileLen(fn))
ff = FreeFile
Open fn For Binary As #ff
Get #ff, , txt
Close #ff
TextBox1.Value = txt

Using the above code I can populate textbox1 with the value in the first line of the text file (settings.txt), but how would I populate textbox2 with the value in the second line in the text file and so on. Each line is either YES or NO in the text file
 

Alan McGowan

Senior Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Sorted by adding the following code

Code:
 Dim myArray() As String
  'Use Split function to return a zero based one dimensional array.
  myArray = Split(txt, vbCrLf)

    TextBox2.Value = myArray(0)
    TextBox3.Value = myArray(1)
    TextBox5.Value = myArray(2)
    TextBox6.Value = myArray(3)
    TextBox7.Value = myArray(4)
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Populate textbox values from one form to another form. Using Outlook 0
cbufacchi Outlook 365 Populate custom Outlook Appoint form Outlook VBA and Custom Forms 2
B Outlook 365 Populate Outlook Task UDFs from a UDF text string Outlook VBA and Custom Forms 2
D Cannot populate certain UserProperties in Outlook from Excel Outlook VBA and Custom Forms 2
C Custom Outlook Form - Populate Information from Radio Button / Check Box Using Outlook 0
C Trying to populate an appointment ComboBox from Excel Outlook VBA and Custom Forms 2
A Populate Listbox from Txt File Outlook VBA and Custom Forms 0
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
Diane Poremsky Outlook VBA: Use a Text File to Populate a ListBox Using Outlook 0
T populate calendar with appointments and send reminders Using Outlook 1
A Populate Excel from Outlook Userform Outlook VBA and Custom Forms 3
J Live Meeting Location populate from body Outlook VBA and Custom Forms 4
A How can I populate a dropdown list? BCM (Business Contact Manager) 4
rohit I want to Populate Popup box while sending any email with attachment. Outlook VBA and Custom Forms 4
rohit I want to Populate Popup box while sending any email with attachment Using Outlook 1
A Cannot populate IMAP folders Using Outlook 1
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
B Auto Populate From Field Using Outlook 3
G Populate an Outlook 2007 template with spreadsheet data. Outlook VBA and Custom Forms 1
R Populate Form with appointments from Calendar Outlook VBA and Custom Forms 1
J populate word template from Outlook custom form Outlook VBA and Custom Forms 2
G Populate BCC field with all Contacts within a Contact Folder Outlook VBA and Custom Forms 4
M Create new Contacts folder and populate it from Access Outlook VBA and Custom Forms 1
A Macro - Open new message, populate from and subject fields, and message text Outlook VBA and Custom Forms 1
G Macro: Create New Message and Auto populate To Field Outlook VBA and Custom Forms 5
S populate body with Word data Outlook VBA and Custom Forms 7
L how to populate multiple users contacts Outlook VBA and Custom Forms 9
A Populate task field based on value of other field Outlook VBA and Custom Forms 9
T Outlook Template - textbox visible based on combobox selection Using Outlook 1
C Calculating Week Number into a TextBox Outlook VBA and Custom Forms 0
J Command Button to stamp a date and time in a textbox in Outlook 2016 Outlook VBA and Custom Forms 3
J Checkboxes when selected will appear in a textbox in Outlook 2016 Outlook VBA and Custom Forms 1
C Transfer Outlook TextBox Text Into Email Body Outlook VBA and Custom Forms 2
F Adding textbox filter to listbox? Outlook VBA and Custom Forms 2
S Outlook code to validate textbox value Using Outlook 1
K TextBox on Custom Form Page :: Passing value from sender to the recipient Outlook VBA and Custom Forms 1
W Custom Task Form: Scrollbars Do Not Appear On Textbox Using Outlook 4
D Outlook 2003 Saving into a textbox when form closes Outlook VBA and Custom Forms 3
D Outlook 2003 bound textbox Outlook VBA and Custom Forms 2
M Delete key in form region textbox deleting email instead Outlook VBA and Custom Forms 2
P Create TextBox in Outlook toolbar Outlook VBA and Custom Forms 1
L How I can obtain the text storage in a textbox in outlook? Outlook VBA and Custom Forms 1
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
T Outlook converts sent email to txt attachments when sync Using Outlook 0
N Paste content to Excel when .txt file (attachment) is opened Outlook VBA and Custom Forms 1
B Outlook 2000 Rule to Move txt msg Not Working if size >24KB Using Outlook 3
T Help! Internally sent emailed Documents changing to notepad .txt Using Outlook 3

Similar threads

Top