A lot of working professionals use text files, they're .txt files. And I'm going to show you how to interface with those in these next two screencasts. The first screencast here is going to be on how to export data to a .txt file. I'm going to show two examples, and then in the next screencast I'm going to show you how you can import data from a text file. So the first example you're going to learn how to take a string from somebody so hello my name is Charlie. They can enter this into an input box, and then that's going to be exported to a text file, and the user can define where they want to put that text file. So I'll just, I guess just use my output example, and then it outputs that string. Now I can go onto my desktop where I placed that text file, I can open up the text file and we see then that in this text file. Text files can be opened with the notepad application that most PC's have. And we have our string that we entered into the input box. So this is known as a .txt file. In the second part of this screencast I'm going to show you how we can take an array, or here we have a vector of strings. And we're going to put this, we're going to import this, or I guess export this to a .txt file. So when we run this, the user, just like we did before, the user can select where they want to place this. So they can name the text file, so I could put that here, I'm just going to rewrite over my previous example. And it will place that into the text file. I can go onto the desktop, and open up that file and we see that it's placed those different elements here. In my vector here we place that into a text file, and sometimes these text files are nice to work with for different applications out there in the real world. So let's go ahead and get started, I've named this sub WriteFile. I've dimmed s as a string, SaveFile, that's going to be the file name that we save it as, that's a string. And we're going to iterate through this, actually we're not going to do that until the second part, so I can eliminate that. We obtain s in an InputBox. And then I'm going to use this GetSaveAsFilename application, that's going to open up that box where the user can type in the name of the text file, and they can navigate to where they want to place that on their hard drive. So we just have this, and I wouldn't bother memorizing this, just kind of make a note of it somewhere. But you can use this, and I'm going to, this is the string then, that's the name that the user types into that box. And then we're going to open up that file for output, and we write to that file, to SaveFile. We're going to write to that, so we write Write #1, s, so that's the string that the user input inputted into the input box. And then we're going to close that text file, so I wouldn't worry too much about the details of this. Just kind of know, use this as a reference for doing this type of work. So let's go ahead and see if this works. A lot of times, especially on newer computers, in particular mine, whenever you bring up another box, like an input box or one of these safe files. And you're debugging, then it just, when you close that box it just automatically goes straight to the end it doesn't stay in debugging mode. And I don't know exactly why, but I'm just going to put a break point here. And we're ready to go, so I'm going to press F8, We obtain the string. We press Enter, and you see down here in the locals window that we've stored that string, and has the variable s. And then we can move to the next one, so we're opening up this Save As dialog box, and I'm just going to save this again as my output example. Click Save, now you see down here in this Locals window we have the SaveFile named, so that's the string where we navigated to. And then we're going to open up that, and it doesn't show you this but we've sort of opened up a hidden text file, we're going to write to that text file. We're going to write the string s, and then we're going to close that, and we End Sub. And now you can go onto your desktop, or wherever you placed that, I placed it on the Desktop, and I open that, and that's where that string has been placed. So now we're going to work with this selection. We're going to import all the items of this selection, so I'm highlighting that selection. For this example, we're not going to need s, so I'm just going to delete that, but we are going to need nr, that's going to be the number of rows of our selection. We're going to need i, because we're going to be iterating in a for loop. We're not going to obtain s in an input box, so I'm just going to delete all that. We need to count the number of rows, so we do nr equals Selection.Rows.Count. And then everything else is pretty similar except when we write we're now going to put this into a for loop. And instead of writing just a single value, we're going to write each Selection.Cells(i, 1) where we're iterating i goes from 1 to nr. So were going in Excel we're going to iterate from Doc down to Dopey, and those are the Selection.Cells(i, 1). We're going to place those one at a time into our text document, and then we're going to close it. So make sure we have our selection over here in Excel, and then I'm just going to put a break point somewhere down in here. And I'm going to press F5 so we can run this. We select where we want to place the text file, so I'll just again replace my output example. Press Save, and then we're going to iterate though here. So we're writing into this text file, we're writing all of the names over here that are in our selection. And we go through all of those, and when we're done we're going to close that, and we End Sub. Now I can go ahead and open up my text file and you see that it's placed those names, the seven dwarfs into this text file in separate lines. So that's how you can use VBA to export information from Excel into a text file.