
' Attempt to open destination file for output. & Chr(10) & "(with complete path):", "Quote-Comma Exporter") Sub QuoteCommaExport()ĭestFile = InputBox("Enter the destination filename" _ Type or paste the following sample code in the module sheet. In the Visual Basic Editor, click Module on the Insert menu. To show the Developer tab in the Ribbon, click the Microsoft Office Button, click Excel Options, click the Popular category, click to select the Show Developer tab in the Ribbon check box, and then click OK.

In Microsoft Office Excel 2007, click the Developer tab, and then click In Microsoft Office Excel 2003 or in Microsoft Excel 2002, point to Macro on the Tools menu, and then click Visual Basic Editor. For the procedure to function correctly, select the cells that contain your data before you run it.īefore you work with the following sample code, follow these steps: You can use the Print # statement in a Visual Basic procedure that is similar to the following to export a text file with both quotation marks and commas as the delimiters.

Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. However, you can create this functionality in Excel by using a Microsoft Visual Basic for Applications procedure.

For example, there is no command to automatically create a text file that contains the following data: Microsoft Excel does not have a menu command to automatically export data to a text file so that the text file is exported with both quotation marks and commas as delimiters.
