![]() |
open text file to extract data
I am only familiar with the very basics of writing macros, but I am trying
my hand at writing my first one with hopes of learning more. I want to write a macro that will save me a lot of repetitive work. The first step is to open a text file in order to extract some data that I can manipulate in Excel. When I do it without a macro, the text import wizard opens and I am able to import the data as from a fixed width file. What I have tried in the macro is not working: Public Sub prepareImport() fileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt") Open "fileToOpen" For Random As #2 End Sub Does anyone have ideas to help me get started? Thanks in advance, Scott |
open text file to extract data
Thank you very much, Dave. That really helped me!
Scott "Dave Peterson" wrote in message ... Try recording a macro when you do it manually. Post back with your recorded code if you have questions. "S.E." wrote: I am only familiar with the very basics of writing macros, but I am trying my hand at writing my first one with hopes of learning more. I want to write a macro that will save me a lot of repetitive work. The first step is to open a text file in order to extract some data that I can manipulate in Excel. When I do it without a macro, the text import wizard opens and I am able to import the data as from a fixed width file. What I have tried in the macro is not working: Public Sub prepareImport() fileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt") Open "fileToOpen" For Random As #2 End Sub Does anyone have ideas to help me get started? Thanks in advance, Scott -- Dave Peterson |
All times are GMT +1. The time now is 12:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com