Hi,
Rather than using the Workbook.Open() method to open the text file in Excel (as per the example on the link you provided), you can directly import the text file using a query table. To get an idea for the code you can follow these steps:
- Turn on the macro recorder
- Data | Import External Data | Import Data
- Browse to a text file and open it
- The text import wizard appears. Follow the steps choosing the approriate options until step 3.
- In step 3 you can customise the column data format. To preserve leading zeros you can select the relevant column(s) and choose Text format.
- Turn off the macro recorder.
- Review the code.
Then you need to understand the code and adapt it so it can be incorporated into your existing procedure.
Hope that helps...