Populate Textbox from Txt File

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.
Thread starter Similar threads Forum Replies Date
S Populate textbox values from one form to another form. Using Outlook 0
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 New Slipstick.com Articles 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
J calendar: populate multiple appointment subject fields at once Using Outlook 4
D Reply to a sender does not populate the To: Field Using Outlook 1
K Quickest way to populate email via IMAP up to a server. Using Outlook 1
M Exchange and IMAP Accounts: Populate Exchange Calendar with IMAP Meeting Requests Using Outlook 1
L Can't populate History of Business Contacts- receive 1st error: cannon load an object because it is not available, then 2nd: Cannot display this view Using Outlook 1
A Uploaded Outlook Contacts Will Not Populate Email Address Using Outlook 2
9 BCM 2010 populate created/due field for created Direct Mail Print Using Outlook 4
C Outlook address book won't populate Using Outlook 2
I Get right account to populate on new e-mail (2010) Using Outlook 1
N Activities Tab does not populate with all linked activity 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
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
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
Similar threads


















































Top