VBA userform textbox to textfile and back

jam1531

New Member
Joined
Jan 5, 2015
Messages
29
Hello,
Stumped on this one. I have a userform with a textbox to input item number(s) and two option buttons "upload" and "retrieve". when the code is run I would like it to doe the following:

If optionbutton1.value = true then

I'd like it to take the item number(s) to be put into a textfile (C:\Users\jmckibb\Desktop\My Stuff\text.txt) and include the Environ("username") and today's date in three columns, for example:

Item_NbrUserIDDate
123456789klj100112/19/18

<tbody>
</tbody>
The catch is if the item number already exists on the sheet then the userID and name need to be replaced with the current Environ("username") and today's date. This way we always have the last to update but do not have duplicates.

Elseif optionbutton2.value = true then
a new workbook is created and the texfile is imported into sheet1 into columns 1, 2 and 3.

End if

Any help appreciated. Thanks!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top