VBA: Save Textbox Value As Text File

Faiek

New Member
Joined
May 2, 2011
Messages
48
Hi,
I'd like to have a button in a userform where the user clicks and It prompts them with the save as dialog. After choosing the location and name it creates a text file and fills it with the data from a textbox. Can Anyone help me with this?

Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
On your button click event add



mytxt = textbox1 'whatever text box your text is in
Open "c:\your file path.txt" For Append As #1 ' change the path to reflect your path
Print #1, mytxt
Close #1

stapuff
 
Last edited:
Upvote 0
This is an old discussion and I have a question.
Instead of this specified path, is it possible to save the text to a default location of the original file?
 
Upvote 0

Forum statistics

Threads
1,224,532
Messages
6,179,388
Members
452,908
Latest member
MTDelphis

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