Consulting | Excel Examples

Importing Text Files into Open Workbook

Keywords: Text, Import, OpenText, Visual Basic, Text Import Wizard, Learn

Description: Use either the OpenText or Dialogs methods to import text into an open workbook. Select the file to import from a built-in dialog box.

Tip: You can use either of two Visual Basic for Applications methods to automate the process of importing text into a workbook. The OpenText method controls all of the text import parameters from the Visual Basic Code. To give the user complete control over Text Import Wizard parameters, use the Dialogs (xlDialogsOpen).Show method

Guide to the Example: Click on the "Import using OpenText" button or "Import Using Dialogs" button to demonstrate these methods.

Download File: Click Here
Tip: Click on the link above and choose "Save" to download the xls workbook to your hard drive or "Open" to open the workbook inside of your browser.

With the OpenText VBA subroutine, all the user needs to do is choose the file to import as shown in figure 1.

Figure 1

The VBA procedure that uses the Dialogs method displays all of the Text Import options as shown in figure 2.

Figure 2


Last modified: May 21, 1996