The information in this article applies to:
SUMMARYIn Microsoft Excel version 5.0, you can use either the Visual Basic Workbooks.OpenText command or the Microsoft Excel version 4.0 OPEN.TEXT macro command to open a text file from a macro. Both commands are equivalent to using the TextWizard to open a text file. However, setting the Consecutive Delimiter argument for either of these commands will have no effect in TextWizard. STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c. MORE INFORMATIONWhen you run a macro using either the Workbook.OpenText or OPEN.TEXT command, the text file will be opened using the Consecutive Delimiter setting that was last set in TextWizard manually. The Consecutive Delimiter argument in the command in a macro is ignored. WORKAROUNDThe following Visual Basic subroutine will, when run, turn on (or off) the "Treat consecutive delimiters as one" check box in the Text Import Wizard:
'Toggles "Treat consecutive delimiters" setting. If off, this line
'turns it on. If already on, this line turns it off.
Application.SendKeys "%fofilelist.txt{enter}%d{enter}%r{esc}"
To use this subroutine, make sure that either
-or- You can then run code containing the Workbooks.OpenText or OPEN.TEXT commands. Additional query words:
Keywords : kbprg |
Last Reviewed: October 6, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |