PDA

View Full Version : File I/O Functions



stanl
02-24-2007, 09:22 AM
I have just started a new position as a rate analyst, and will inherit or be asked to 'look at' several humongous workbooks with data that is copied/paste, manually entered or failing with recorded macros. The horizon seems to include delimited files for parsing and export. I am used to scripting with access to C++ dll's that make file i/o simple... for example if I wanted to load a file in the current subdir into a memory variable and convert , into Tab I could

memvar = StrReplace(Fileget(curdir():"test.csv"),",",@TAB)

Since I do not have the capacity to use that language, I'm wondering if there is a generic set of VBA File i/o functions to handle

locating text files and opening them
writing output files. By generic, I mean callable from any sub in any given workbook?

TIA... Stan

Bob Phillips
02-24-2007, 09:40 AM
Stan,

You need to create a few file access classes. Sounds like you would best use the ADO and/or FileSystemobject, with these you can abstratc you applications from the data.

stanl
02-24-2007, 10:25 AM
Stan,

You need to create a few file access classes. Sounds like you would best use the ADO and/or FileSystemobject, with these you can abstratc you applications from the data.

I agree, but being old and perhaps a bit lazy, I guess I was wondering if someone had already done some of that. I have asked the IT group for permission to install LogParser 2.2 [free from Microsoft] on my workplace PC, and eliminate 99% of the need]. Not easy being the new/old guy... Catch-22... exhortations about you bringing in new efficiencies; reservations whan you actually start doing it:banghead: Stan

Norie
02-25-2007, 01:52 AM
HAve you not looked at the standard VBA file input/output methods?

Or perhaps the File System Object?

Bob Phillips
02-25-2007, 03:16 AM
Norie,

From Stan's response to it seems he is well aware of all of the possibilities, he was just looking to shortcut it, and not re-invent any wheels.